We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1d51353 commit 2da7ff5Copy full SHA for 2da7ff5
test/parallel/test-worker-ref-onexit.js
@@ -5,6 +5,8 @@ const { Worker } = require('worker_threads');
5
// Check that worker.unref() makes the 'exit' event not be emitted, if it is
6
// the only thing we would otherwise be waiting for.
7
8
-const w = new Worker('', { eval: true });
+// 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 });
11
w.unref();
12
w.on('exit', common.mustNotCall());
0 commit comments