mirror of
https://github.com/nodejs/node.git
synced 2025-05-17 12:08:20 +00:00

Manually fix issues that eslint --fix couldn't do automatically. PR-URL: https://github.com/nodejs/node/pull/10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
28 lines
676 B
JavaScript
28 lines
676 B
JavaScript
'use strict';
|
|
/*
|
|
* This test is a regression test for joyent/node#8900.
|
|
*/
|
|
const common = require('../common');
|
|
|
|
const TEST_DURATION = common.platformTimeout(1000);
|
|
const N = 3;
|
|
let nbIntervalFired = 0;
|
|
|
|
const keepOpen = setTimeout(() => {
|
|
console.error('[FAIL] Interval fired %d/%d times.', nbIntervalFired, N);
|
|
throw new Error('Test timed out. keepOpen was not canceled.');
|
|
}, TEST_DURATION);
|
|
|
|
const timer = setInterval(() => {
|
|
++nbIntervalFired;
|
|
if (nbIntervalFired === N) {
|
|
clearInterval(timer);
|
|
timer._onTimeout = () => {
|
|
throw new Error('Unrefd interval fired after being cleared.');
|
|
};
|
|
clearTimeout(keepOpen);
|
|
}
|
|
}, 1);
|
|
|
|
timer.unref();
|