From b1155de6e232d603679d6a8ae796e831368aa814 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. --- 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); });