summaryrefslogtreecommitdiff
path: root/test/parallel/test-async-hooks-enable-disable-enable.js
blob: 640815e14c8c9de63702445ac9f15953ec34e170 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'use strict';
const common = require('../common');
const assert = require('assert');
const async_hooks = require('async_hooks');

// Regression test for https://github.com/nodejs/node/issues/27585.

async_hooks.createHook({ init: () => {} }).enable().disable().enable();
async_hooks.createHook({ init: () => {} }).enable();

async function main() {
  const initialAsyncId = async_hooks.executionAsyncId();
  await 0;
  assert.notStrictEqual(async_hooks.executionAsyncId(), initialAsyncId);
}

main().then(common.mustCall());