1'use strict'; 2require('../common'); 3 4const assert = require('assert'); 5const async_hooks = require('async_hooks'); 6const triggerAsyncId = async_hooks.triggerAsyncId; 7 8const triggerAsyncId0 = triggerAsyncId(); 9let triggerAsyncId1; 10 11process.nextTick(() => { 12 process.nextTick(() => { 13 triggerAsyncId1 = triggerAsyncId(); 14 // Async resources having different causal ancestry 15 // should have different triggerAsyncIds 16 assert.notStrictEqual( 17 triggerAsyncId0, 18 triggerAsyncId1); 19 }); 20 process.nextTick(() => { 21 const triggerAsyncId2 = triggerAsyncId(); 22 // Async resources having the same causal ancestry 23 // should have the same triggerAsyncId 24 assert.strictEqual( 25 triggerAsyncId1, 26 triggerAsyncId2); 27 }); 28}); 29