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); });