summaryrefslogtreecommitdiff
path: root/test/parallel/test-async-hooks-run-in-async-id-scope.js
blob: 8cef7d214c2b4f491e478edb38bda712e1120adb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
'use strict';

const common = require('../common');
const assert = require('assert');
const async_hooks = require('async_hooks');

const asyncId = async_hooks.newUid();

assert.notStrictEqual(async_hooks.executionAsyncId(), asyncId);

async_hooks.runInAsyncIdScope(asyncId, common.mustCall(() => {
  assert.strictEqual(async_hooks.executionAsyncId(), asyncId);
}));