-
-
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
--detectOpenHandles
shouldn't report unreferenced workers.
#11707
Comments
There is no |
Filed nodejs/node#42091 |
@nicolo-ribaudo fixed in Jest 28.0, but you need node 18.1 which got released an hour ago for the fix that landed in jest 28 to work 😅 |
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
Node.js workers have an
.unref()
method that, when called, makes them not prevent the main thread from exiting. It's similar tosetTimeout().unref()
.If a worker has been
.unref()
ed, Jest shouldn't report it in--detectOpenHandles
. This is siilar to #8941To Reproduce
I have two file:
test.js
andworker.js
(I tested them in a bigger repository; if needed I'll create a self-contained repo).test.js
:worker.js
:Expected behavior
When running
node test.js
it logs"DONE"
, and the process exits immediately (without logging"XX"
).When running
test.js
with Jest, it (correctly) logsand then exits immediately.
When running
test.js
with Jest and--detectOpenHandles
, it logsThis worker doesn't prevent the process from exiting, so it shouldn't be reported. It should still be reported if you delete
worker.unref()
from my example.envinfo
Context
In the Babel repo we have a test where 90% of the times every test passes, but then Jest waits without ever exiting (and CircleCI kills it after 10 mins without output, marking it as failed). I tried using the
--detectOpenHandles
option, but it only reports a worker for which I was callingworker.unref()
(CircleCI output).The text was updated successfully, but these errors were encountered: