• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3// Regression test for https://github.com/nodejs/node-v0.x-archive/issues/8897.
4
5// Test some private implementation details that should not be
6// considered public interface.
7const common = require('../common');
8const timers = require('timers');
9
10const foo = {
11  _onTimeout: common.mustNotCall('_onTimeout should not be called')
12};
13
14const bar = {
15  _onTimeout: common.mustCall(function() {
16    timers.unenroll(foo);
17  })
18};
19
20// We use timers with expiration times that are sufficiently apart to make
21// sure that they're not fired at the same time on platforms where the timer
22// resolution is a bit coarse (e.g Windows with a default resolution of ~15ms).
23timers.enroll(bar, 1);
24timers._unrefActive(bar);
25
26timers.enroll(foo, 50);
27timers._unrefActive(foo);
28
29// Keep the process open.
30setTimeout(() => {}, 100);
31