-
-
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
Open Knex database causes open handles issues in Jest 27 #11463
Comments
Running wtfnode shows that a timer from Knex's Tarn connection pool is what's keeping Jest from exiting:
Jest should probably show non-user-created resources to help troubleshoot issues like this; see this comment. (In other words, these two issues may be at least partial duplicates.) |
Similar behaviour occurs when a |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
Has anyone found a great workaround for this? I found that I can call |
Have you tried using global teardown? |
Thanks, I think that's a near-perfect fit! Unfortunately pointing
does not work in practice in our case because the "sharedConnection" module ends up not actually being fully shared for some reason! (i.e. the instance that gets |
If that is a shared |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
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. |
🐛 Bug Report
If a test creates an in-memory SQLite3 Knex database and doesn't destroy it, then Jest 27 hangs with the following error:
If I run with
--detectOpenHandles
, then Jest doesn't print any messages, but it still hangs once the tests have finished.(This is the same issue as #9473, but it occurs in Jest 27.)
This issue only happens in Jest 27. In Jest 26 and jest-circus 26, Jest cleanly exits with no warnings.
To Reproduce
Steps to reproduce the behavior: Clone the https://github.com/joshkel/jest-knex-open-handles repository and run
npm i && npm test
Downgrade to Jest 26 and note that it cleanly exits:
npm i jest@^26 jest-circus@^26 && npm test
Expected behavior
Jest cleanly exits; or, if Jest doesn't cleanly exit because of the open database, then
--detectOpenHandles
should explain the problem.Link to repl or repo (highly encouraged)
https://github.com/joshkel/jest-knex-open-handles
envinfo
The text was updated successfully, but these errors were encountered: