You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
768 B

'use strict';
require('../common');
const assert = require('assert');
const async_hooks = require('async_hooks');
const triggerAsyncId = async_hooks.triggerAsyncId;
const triggerAsyncId0 = triggerAsyncId();
let triggerAsyncId1;
process.nextTick(() => {
process.nextTick(() => {
triggerAsyncId1 = triggerAsyncId();
assert.notStrictEqual(
triggerAsyncId0,
triggerAsyncId1,
'Async resources having different causal ancestry ' +
'should have different triggerAsyncIds');
});
process.nextTick(() => {
const triggerAsyncId2 = triggerAsyncId();
assert.strictEqual(
triggerAsyncId1,
triggerAsyncId2,
'Async resources having the same causal ancestry ' +
'should have the same triggerAsyncId');
});
});