test: fix flaky test-worker-ref-onexit
Fixes: https://github.com/nodejs/node/issues/26167 PR-URL: https://github.com/nodejs/node/pull/26170 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
This commit is contained in:
parent
1d51353665
commit
2da7ff5e96
@ -5,6 +5,8 @@ const { Worker } = require('worker_threads');
|
|||||||
// Check that worker.unref() makes the 'exit' event not be emitted, if it is
|
// Check that worker.unref() makes the 'exit' event not be emitted, if it is
|
||||||
// the only thing we would otherwise be waiting for.
|
// the only thing we would otherwise be waiting for.
|
||||||
|
|
||||||
const w = new Worker('', { eval: true });
|
// Use `setInterval()` to make sure the worker is alive until the end of the
|
||||||
|
// event loop turn.
|
||||||
|
const w = new Worker('setInterval(() => {}, 100);', { eval: true });
|
||||||
w.unref();
|
w.unref();
|
||||||
w.on('exit', common.mustNotCall());
|
w.on('exit', common.mustNotCall());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user