mirror of
https://github.com/nodejs/node.git
synced 2025-05-07 15:35:41 +00:00

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>
25 lines
549 B
JavaScript
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();
|