blob: e8b4682b7167f899880e5f67688000bdc6be139a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
'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();
// Async resources having different causal ancestry
// should have different triggerAsyncIds
assert.notStrictEqual(
triggerAsyncId0,
triggerAsyncId1);
});
process.nextTick(() => {
const triggerAsyncId2 = triggerAsyncId();
// Async resources having the same causal ancestry
// should have the same triggerAsyncId
assert.strictEqual(
triggerAsyncId1,
triggerAsyncId2);
});
});
|