• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2// Regression test for https://github.com/nodejs/node-v0.x-archive/issues/8900.
3const common = require('../common');
4
5const TEST_DURATION = common.platformTimeout(1000);
6let N = 3;
7
8const keepOpen =
9  setTimeout(
10    common.mustNotCall('Test timed out. keepOpen was not canceled.'),
11    TEST_DURATION);
12
13const timer = setInterval(common.mustCall(() => {
14  if (--N === 0) {
15    clearInterval(timer);
16    timer._onTimeout =
17      common.mustNotCall('Unrefd interval fired after being cleared');
18    clearTimeout(keepOpen);
19  }
20}, N), 1);
21
22timer.unref();
23