0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-24 12:10:08 +01:00
nodejs/test/parallel/test-timers-unrefd-interval-still-fires.js
Rich Trott f593f9e9ef test: adjust comments for upcoming lint rule
Enforce `//` for multiline comments. Some tests mixed and matched, and
at least one did so in a (to me) surprising way.

PR-URL: https://github.com/nodejs/node/pull/35485
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-10-07 04:36:02 -07:00

23 lines
566 B
JavaScript

'use strict';
// Regression test for https://github.com/nodejs/node-v0.x-archive/issues/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();