From 7e1f61070ebcd62a3580d31f11664add78508aa0 Mon Sep 17 00:00:00 2001 From: Anatoli Papirovski Date: Tue, 29 May 2018 23:02:25 +0200 Subject: [PATCH] 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 Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat Reviewed-By: James M Snell Reviewed-By: Weijia Wang Reviewed-By: Daniel Bevenius --- test/parallel/test-domain-timers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-domain-timers.js b/test/parallel/test-domain-timers.js index b6883d8c223d05..83d535938964be 100644 --- a/test/parallel/test-domain-timers.js +++ b/test/parallel/test-domain-timers.js @@ -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); });