mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 23:16:30 +01:00
7192e913f7
PR-URL: https://github.com/nodejs/node/pull/14616 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com>
25 lines
548 B
JavaScript
25 lines
548 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 interal fired after being cleared');
|
|
clearTimeout(keepOpen);
|
|
}
|
|
}, N), 1);
|
|
|
|
timer.unref();
|