• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4const initHooks = require('./init-hooks');
5const verifyGraph = require('./verify-graph');
6const TIMEOUT = 1;
7
8const hooks = initHooks();
9hooks.enable();
10
11setTimeout(common.mustCall(ontimeout), TIMEOUT);
12function ontimeout() {
13  setTimeout(onsecondTimeout, TIMEOUT + 1);
14}
15
16function onsecondTimeout() {
17  setTimeout(onthirdTimeout, TIMEOUT + 2);
18}
19
20function onthirdTimeout() {}
21
22process.on('exit', onexit);
23
24function onexit() {
25  hooks.disable();
26  verifyGraph(
27    hooks,
28    [ { type: 'Timeout', id: 'timeout:1', triggerAsyncId: null },
29      { type: 'Timeout', id: 'timeout:2', triggerAsyncId: 'timeout:1' },
30      { type: 'Timeout', id: 'timeout:3', triggerAsyncId: 'timeout:2' }]
31  );
32}
33