node/test/parallel/test-timers-unrefd-interval-still-fires.js
Brandon Smith 13340d47fc benchmark,doc,lib,src,test,tools: fix typos
PR-URL: https://github.com/nodejs/node/pull/23302
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2018-10-09 16:53:12 +03:00

25 lines
549 B
JavaScript

'use strict';
/*
* This test is a regression test for joyent/node#8900.
*/
const common = require('../common');
const TEST_DURATION = common.platformTimeout(1000);
let N = 3;
const keepOpen =
setTimeout(
common.mustNotCall('Test timed out. keepOpen was not canceled.'),
TEST_DURATION);
const timer = setInterval(common.mustCall(() => {
if (--N === 0) {
clearInterval(timer);
timer._onTimeout =
common.mustNotCall('Unrefd interval fired after being cleared');
clearTimeout(keepOpen);
}
}, N), 1);
timer.unref();