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 11let count = 0; 12const iv1 = setInterval(common.mustCall(onfirstInterval, 3), TIMEOUT); 13let iv2; 14 15function onfirstInterval() { 16 if (++count === 3) { 17 clearInterval(iv1); 18 iv2 = setInterval(common.mustCall(onsecondInterval, 1), TIMEOUT + 1); 19 } 20} 21 22function onsecondInterval() { 23 clearInterval(iv2); 24} 25 26process.on('exit', onexit); 27 28function onexit() { 29 hooks.disable(); 30 verifyGraph( 31 hooks, 32 [ { type: 'Timeout', id: 'timeout:1', triggerAsyncId: null }, 33 { type: 'Timeout', id: 'timeout:2', triggerAsyncId: 'timeout:1' }] 34 ); 35} 36