Skip to content

Commit

Permalink
test: fix flaky test-domain-timers
Browse files Browse the repository at this point in the history
It's possible for this test to be extremely infrequently flaky if
1ms or more elapses between setting the two timeouts. In that case,
the second timer will not fire and the test will fail.

PR-URL: #21019
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Weijia Wang <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
  • Loading branch information
apapirovski committed Jun 1, 2018
1 parent 7c8eec0 commit 4b8ff3a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/parallel/test-domain-timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const timeoutd = domain.create();

timeoutd.on('error', common.mustCall(function(e) {
assert.strictEqual(e.message, 'Timeout UNREFd');
clearTimeout(timeout);
}, 2));

let t;
Expand All @@ -38,6 +37,7 @@ timeoutd.run(function() {
}, 0).unref();

t = setTimeout(function() {
clearTimeout(timeout);
throw new Error('Timeout UNREFd');
}, 0);
});
Expand Down

0 comments on commit 4b8ff3a

Please sign in to comment.