-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DNSCHANNEL stops jest from closing #6423
Comments
I'm seeing the same issue here. |
We're not always able to point to user code - if it just shows dns it might be some polling or some such. Do you think you could put together a repo we could pull down showing the error? |
Why is there DNS involved in filesystem polling anyways? It's a bit difficult for me to isolate a repo for this, but it usually happens on functional tests with database setup in the beginning. My test itself looks like this: import request from 'supertest';
import app from '../../app';
import knex from '../../knex';
import User from '../../models/user';
const userData = {/* ... */};
describe('/signup', () => {
beforeEach(async () => {
await knex.migrate.rollback();
await knex.migrate.latest();
});
describe('GET', () => {
test('should respond with 200 OK', async () => {
await request(app).get('/signup').expect(200);
});
});
describe('POST', () => {
// TODO: create verifications and test these verifications
test('should respond with 302 FOUND', async () => {
await request(app).post('/signup').send(userData).expect(302);
// TODO: test cookies set properly
});
test('should create the correct database entries', async () => {
await request(app).post('/signup').send(userData);
const users = await Promise.all([
User.findByPrimaryEmail(userData.email),
User.findByPrimaryPhone(userData.phone),
User.findByPrimaryWeChat(userData.wechat),
User.findByPrimaryQQ(userData.qq)
]);
const userId = users[0].userId;
expect(userId).toBeDefined();
users.forEach((user) => expect(user.userId).toEqual(userId));
});
});
}); |
Same issue here. It is caused by
module version |
I'll also point out that this does not mean there's a bug in Jest - the flag exists to help you track down what's not cleaned up in your own code. I'm therefore closing this issue. I have an open PR for fixing handles opened up within a test, which is currently not working: #6263 I'd still be interested in an example showing just |
In order to solve this issue, I found two critical problems in a project and one antipattern we've been using. Hope this information will help everyone who faced same issue:
Wrong version
Fixed version:
Wrong version:
Fixed version:
|
same issue here. test:
result
include db models (sequelize + postgres)
result:
|
If you put together a reproduction showing it, I can take a look at if it's possible to improve the message |
Hey guys, does anyone know a solution for GraphQL Yoga? The server doesn't have a listen method, so we can't return it. |
For Googlers: I have a file Renaming the mock file to |
test.spec.ts // https://nodejs.org/docs/latest-v12.x/api/dns.html#dns_dns_promises_api
import { promises } from 'dns';
test('Node.js DNS', () => {
const { Resolver } = promises;
const resolver = new Resolver();
expect(typeof resolver).toBe('object');
const servers = resolver.getServers();
console.log(servers);
}); I haven't found a way to close the open handle. |
I think it's a bug in Jest since the process exits normally. |
I was seeing this with node |
Even when i upgrade to Did you change anything else ? |
@jean-smaug This works for me:
All the versions:
|
Can confirm that this issue still exists, in my case it does prevent jest to exit, thus requiring
with all up-to-date versions:
|
In my opinion, the issue is between
@SimenB could it be possible to re-open this issue ? const { Resolver } = require('dns').promises;
it('detects an open handle', () => {
new Resolver();
expect(true);
}); |
@fungiboletus please open up a new issue - this has been closed for 2 years |
It has been created as a new issue. #9982 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Jest does not closed himself after test finished
--detectOpenHandles suggest I need to close DNSCHANNEL manually:
But I cannot find any additonal information based on that problem.
I have async tests running supertest and jest.
Test code
The text was updated successfully, but these errors were encountered: