From 802a945d818c2d397d4f399e54f3bb007804be13 Mon Sep 17 00:00:00 2001 From: Zahidul Islam Date: Sat, 22 Apr 2017 12:28:22 -0700 Subject: [PATCH] test: add mustCall in timers-unrefed-in-callback PR-URL: https://github.com/nodejs/node/pull/12594 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott Reviewed-By: James M Snell Reviewed-By: Brian White --- test/parallel/test-timers-unrefed-in-callback.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-timers-unrefed-in-callback.js b/test/parallel/test-timers-unrefed-in-callback.js index c6fcb22789..50e6881bd3 100644 --- a/test/parallel/test-timers-unrefed-in-callback.js +++ b/test/parallel/test-timers-unrefed-in-callback.js @@ -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; @@ -28,7 +27,7 @@ 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); @@ -36,7 +35,7 @@ function Test1() { Test2(); }); } - }, 1); + }, 4), 1); } @@ -54,8 +53,4 @@ function Test2() { }, 1); } -process.on('exit', () => { - assert.strictEqual(counter1, 4); -}); - Test1();