Skip to content

Commit 2da7ff5

Browse files
committed
test: fix flaky test-worker-ref-onexit
Fixes: #26167 PR-URL: #26170 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Beth Griggs <[email protected]>
1 parent 1d51353 commit 2da7ff5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/parallel/test-worker-ref-onexit.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ const { Worker } = require('worker_threads');
55
// Check that worker.unref() makes the 'exit' event not be emitted, if it is
66
// the only thing we would otherwise be waiting for.
77

8-
const w = new Worker('', { eval: true });
8+
// Use `setInterval()` to make sure the worker is alive until the end of the
9+
// event loop turn.
10+
const w = new Worker('setInterval(() => {}, 100);', { eval: true });
911
w.unref();
1012
w.on('exit', common.mustNotCall());

0 commit comments

Comments
 (0)