title: Jest doesn't exit properly
body: <p>When running this integration test with Jest in nodeJS:</p>
  
  <pre><code>const request = require("supertest");
  let server;
  
  describe("/api/chat", () =&gt; {
    beforeEach(() =&gt; {
      server = require("../../api");
    });
    describe("GET /userlist", () =&gt; {
      it("show userlist", async () =&gt; {
        const result = await request(server)
          .get("/api/chat/userlist")
          .set("X-Auth", process.env.XAuth);
        expect(result.status).toBe(200);
      });
    });
    afterAll(done =&gt; {
      server.close(done);
    });
  });
  </code></pre>
  
  <p>With the api.js file:</p>
  
  <pre><code>const PORT = process.env.PORT;
  
  const server = app.listen(PORT, () =&gt; {
    console.log(`listening on port ${PORT}`);
  });
  
  app.use("/api/chat", chat);
  
  module.exports = server;
  </code></pre>
  
  <p>I get an an error, that it something keeps it up from exiting:</p>
  
  <pre><code>Jest has detected the following 1 open handle potentially keeping Jest from exiting:
  
    ●  TCPSERVERWRAP
  
        21 | const PORT = process.env.PORT;
        22 | 
      &gt; 23 | const server = app.listen(PORT, () =&gt; {
           |                    ^
        24 |   console.log(`listening on port ${PORT}`);
        25 | });
        26 | 
  </code></pre>
  
  <p>Any ideas? I checked already on Github but nothing really helped or was just a workaround. How can I properly close the connection?</p>