Skip to content

Commit 3fd890a

Browse files
ChatbotSchoolTrott
authored andcommitted
test: add mustCall in timers-unrefed-in-callback
PR-URL: #12594 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Brian White <[email protected]>
1 parent 1c834e7 commit 3fd890a

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

test/parallel/test-timers-unrefed-in-callback.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
// Checks that setInterval timers keep running even when they're
33
// unrefed within their callback.
44

5-
require('../common');
6-
const assert = require('assert');
5+
const common = require('../common');
76
const net = require('net');
87

98
let counter1 = 0;
@@ -28,15 +27,15 @@ function Test1() {
2827
// server only for maintaining event loop
2928
const server = net.createServer().listen(0);
3029

31-
const timer1 = setInterval(() => {
30+
const timer1 = setInterval(common.mustCall(() => {
3231
timer1.unref();
3332
if (counter1++ === 3) {
3433
clearInterval(timer1);
3534
server.close(() => {
3635
Test2();
3736
});
3837
}
39-
}, 1);
38+
}, 4), 1);
4039
}
4140

4241

@@ -54,8 +53,4 @@ function Test2() {
5453
}, 1);
5554
}
5655

57-
process.on('exit', () => {
58-
assert.strictEqual(counter1, 4);
59-
});
60-
6156
Test1();

0 commit comments

Comments
 (0)