Closed
Description
What is the problem this feature will solve?
Jest has a --detect-open-handles
flag which attempts to figure out (using async_hooks
) what resources (timer/server etc.) are preventing a test run/node from exiting. To avoid false positives we perform filtering before presenting the list to the user. One of those things is to check if a Timer
has been unrefed
or not, via Timer.hasRef
.
However, Worker
s have no hasRef
, even though they have the {un}ref
pair, so Jest will currently print false positives for Worker
s that have had unref
called.
What is the feature you are proposing to solve the problem?
Add Worker.hasRef
similar to the Timer
API.
What alternatives have you considered?
No response
Activity
--detectOpenHandles
shouldn't report unreferenced workers. jestjs/jest#11707targos commentedon Feb 23, 2022
What about other APIs that have an
unref
function? ChildProcess, FSWatcher, etc.SimenB commentedon Feb 23, 2022
I haven't gotten a bug report in Jest about them, so I have no opinion 😀
On a more serious note, I think it makes sense for
ref
,unref
andhasRef
to always exist together.benjamingr commentedon Feb 23, 2022
@SimenB would you be interested in contributing a PR? I am happy to guide you, the code is in
io.js
andworker.js
mostly :)SimenB commentedon Feb 23, 2022
Io.js, that's a blast from the past! Happy to contribute it if it'll get accepted 🙂
child_process: add hasRef to ChildProcess
child_process: add hasRef to ChildProcess
child_process: add hasRef to ChildProcess
worker: add hasRef()
35 remaining items