Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();