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