Skip to content

Commit

Permalink
test: fix flaky test-worker-ref-onexit
Browse files Browse the repository at this point in the history
Fixes: #26167

PR-URL: #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>
  • Loading branch information
addaleax authored and rvagg committed Feb 28, 2019
1 parent dab64bb commit 441b545
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/parallel/test-worker-ref-onexit.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ const { Worker } = require('worker_threads');
// Check that worker.unref() makes the 'exit' event not be emitted, if it is
// 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.on('exit', common.mustNotCall());

0 comments on commit 441b545

Please sign in to comment.