/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v26.3.1
test/async-hooks/test-graph.intervals.js
35 строк
755 B
Antoine du Hamel
test: add trailing commas in async-hooks tests (#45549)
21 ноя 2022, 20:43
Не верифицирован
21 ноя 2022, 20:43
cf46746
Код
Авторство
О чём код?
'use strict'; const common = require('../common'); const initHooks = require('./init-hooks'); const verifyGraph = require('./verify-graph'); const TIMEOUT = 1; const hooks = initHooks(); hooks.enable(); let count = 0; const iv1 = setInterval(common.mustCall(onfirstInterval, 3), TIMEOUT); let iv2; function onfirstInterval() { if (++count === 3) { clearInterval(iv1); iv2 = setInterval(common.mustCall(onsecondInterval, 1), TIMEOUT + 1); } } function onsecondInterval() { clearInterval(iv2); } process.on('exit', onexit); function onexit() { hooks.disable(); verifyGraph( hooks, [ { type: 'Timeout', id: 'timeout:1', triggerAsyncId: null }, { type: 'Timeout', id: 'timeout:2', triggerAsyncId: 'timeout:1' }], ); }