Skip to content

Commit 556703d

Browse files
TrottMyles Borins
authored and
Myles Borins
committed
test: fix flaky unrefed timers test
Remove unnecessary `setImmediate()` that causes a minor race condition. Stop the test after 3 occurrences rather than 5 to allow for slower hosts running the test in parallel with other tests. Fixes: #4559 PR-URL: #4599 Reviewed-By: Johan Bergström <[email protected]>
1 parent 15fa555 commit 556703d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/parallel/test-timers-unrefd-interval-still-fires.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
const common = require('../common');
66

77
const TEST_DURATION = common.platformTimeout(100);
8-
const N = 5;
8+
const N = 3;
99
var nbIntervalFired = 0;
1010

1111
const keepOpen = setTimeout(() => {
@@ -20,7 +20,7 @@ const timer = setInterval(() => {
2020
timer._onTimeout = () => {
2121
throw new Error('Unrefd interval fired after being cleared.');
2222
};
23-
setImmediate(() => clearTimeout(keepOpen));
23+
clearTimeout(keepOpen);
2424
}
2525
}, 1);
2626

0 commit comments

Comments
 (0)