Skip to content

Commit

Permalink
test: add mustCall in timers-unrefed-in-callback
Browse files Browse the repository at this point in the history
PR-URL: #12594
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
  • Loading branch information
ChatbotSchool authored and gibfahn committed Jun 20, 2017
1 parent 11a7875 commit 72040cd
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions test/parallel/test-timers-unrefed-in-callback.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// Checks that setInterval timers keep running even when they're
// unrefed within their callback.

require('../common');
const assert = require('assert');
const common = require('../common');
const net = require('net');

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

const timer1 = setInterval(() => {
const timer1 = setInterval(common.mustCall(() => {
timer1.unref();
if (counter1++ === 3) {
clearInterval(timer1);
server.close(() => {
Test2();
});
}
}, 1);
}, 4), 1);
}


Expand All @@ -54,8 +53,4 @@ function Test2() {
}, 1);
}

process.on('exit', () => {
assert.strictEqual(counter1, 4);
});

Test1();

0 comments on commit 72040cd

Please sign in to comment.