title: Node.JS integration test error: listen EADDRINUSE: address already in use :::3000
body: <p>I've used <a href="https://www.npmjs.com/package/jest" rel="nofollow noreferrer">jest</a> and <a href="https://www.npmjs.com/package/supertest" rel="nofollow noreferrer">supertest</a> for integration tests. In afterEach section I closed server:</p>
  <pre><code>let server;
  describe('/api/user', () =&gt; {
     beforeEach(() =&gt; {
        server = require('../../../app');
     });
  
     afterEach(async () =&gt; {
        await server.close();
     });
  //some tests
  });
  </code></pre>
  <p>But by running <code>npm test</code> I get this error:
  <strong>listen EADDRINUSE: address already in use :::3200</strong></p>
  <p>When I using just one something.test.js file, everything is OK. The problem is when I add a new something.test.js. What's wrong?</p>
  <p>Here is the package.json:</p>
  <pre><code>{
    &quot;name&quot;: &quot;users&quot;,
    &quot;version&quot;: &quot;1.0.0&quot;,
    &quot;description&quot;: &quot;&quot;,
    &quot;main&quot;: &quot;app.js&quot;,
    &quot;scripts&quot;: {
      &quot;test&quot;: &quot;jest --watchAll&quot;
    },
    &quot;author&quot;: &quot;Saeed Heidarbozorg&quot;,
    &quot;license&quot;: &quot;ISC&quot;,
    &quot;dependencies&quot;: {
      &quot;config&quot;: &quot;^3.3.4&quot;,
      &quot;express&quot;: &quot;^4.17.1&quot;,
      &quot;express-async-errors&quot;: &quot;^3.1.1&quot;,
      &quot;joi&quot;: &quot;^17.4.0&quot;,
      &quot;morgan&quot;: &quot;^1.10.0&quot;,
      &quot;pg&quot;: &quot;^8.5.1&quot;,
      &quot;winston&quot;: &quot;^3.3.3&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;jest&quot;: &quot;^26.6.3&quot;,
      &quot;supertest&quot;: &quot;^6.1.3&quot;
    }
  }
  
  </code></pre>