question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DNSCHANNEL stops jest from closing

See original GitHub issue

Jest does not closed himself after test finished

–detectOpenHandles suggest I need to close DNSCHANNEL manually:

Jest has detected the following 1 open handle potentially keeping Jest from exiting:

  ●  DNSCHANNEL

      at dns.js:333:23

But I cannot find any additonal information based on that problem.

I have async tests running supertest and jest.

    "express": "^4.16.3",
    "jest": "^23.1.0",
    "supertest": "^3.1.0",
    "pg": "^7.4.3",
    "pg-pool": "^2.0.3"

Test code

const request = require('supertest');
const app = require('server');

// close the server after each test
afterEach(async () => {
  await app.db.close();
});

const wFixture = [{
      "complexity": 3,
}];

describe('Controllers', () => {
  test('list get method', async () => {
    const response = await request(app).get('/');
    expect(response.status).toEqual(200);
    expect(response.body.count).toEqual(1);
    expect(response.body.data).toEqual(wFixture);
  });
});

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:20
  • Comments:20

github_iconTop GitHub Comments

9reactions
mgcreacommented, Nov 10, 2020

Can confirm that this issue still exists, in my case it does prevent jest to exit, thus requiring --forceExit:

Jest has detected the following 1 open handle potentially keeping Jest from exiting:

  ●  DNSCHANNEL

      at new CacheableLookup (node_modules/cacheable-lookup/source/index.js:75:14)
      at Object.<anonymous> (node_modules/got/dist/source/core/index.js:32:24)
      at Object.<anonymous> (node_modules/got/dist/source/as-promise/types.js:14:16)

with all up-to-date versions:

- nock@13.0.4
- got@11.8.0
- jest@26.6.3
- node v14.15.0 (node@14 via brew)
- OSX 10.15.7
6reactions
linkennethcommented, Jun 9, 2018

I’m seeing the same issue here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest detects open handle DNSCHANNEL if node package got ...
I'm programming server in Node.js v12.18.3 , using Express framework. My code uses Jest for unit testing. In one of my module, I've...
Read more >
Testing Asynchronous Code - Jest
When you have code that runs asynchronously, Jest needs to know when the code it is testing has completed, before it can move...
Read more >
Jest Detects Open Handle With Express App - ADocLib
erfanium posted onGitHub Jest has detected the following 1 open handle potentially keeping Jest from exiting: DNSCHANNEL at new CacheableLookup.
Read more >
Jest shows a warning after updating got 11.5.1 - Issuehunt
Jest has detected the following 1 open handle potentially keeping Jest from exiting: ○ DNSCHANNEL at new CacheableLookup ...
Read more >
Make Jest for LWC [closed] - Salesforce Stack Exchange
Stop defacing your question. The contents of your question are important for understanding the answer that you've received. This site isn't here ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found