mirror of
https://github.com/zebrajr/node.git
synced 2025-12-07 00:20:38 +01:00
Backport-PR-URL: https://github.com/nodejs/node/pull/18179 PR-URL: https://github.com/nodejs/node/pull/16972 Refs: https://github.com/nodejs/node/issues/14328 Refs: https://github.com/nodejs/node/issues/15572 Reviewed-By: Anna Henningsen <anna@addaleax.net>
14 lines
393 B
JavaScript
14 lines
393 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const async_hooks = require('async_hooks');
|
|
|
|
const asyncId = new async_hooks.AsyncResource('test').asyncId();
|
|
|
|
assert.notStrictEqual(async_hooks.executionAsyncId(), asyncId);
|
|
|
|
async_hooks.runInAsyncIdScope(asyncId, common.mustCall(() => {
|
|
assert.strictEqual(async_hooks.executionAsyncId(), asyncId);
|
|
}));
|