test: fix flaky test-domain-timers

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: https://github.com/nodejs/node/pull/21019
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
This commit is contained in:
Anatoli Papirovski
2018-05-29 23:02:25 +02:00
parent 7c8eec0648
commit 4b8ff3a424

View File

@@ -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;
@@ -38,6 +37,7 @@ timeoutd.run(function() {
}, 0).unref();
t = setTimeout(function() {
clearTimeout(timeout);
throw new Error('Timeout UNREFd');
}, 0);
});