11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_cirequire('../common'); 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ciconst assert = require('assert'); 51cb0ef41Sopenharmony_ciconst async_hooks = require('async_hooks'); 61cb0ef41Sopenharmony_ciconst triggerAsyncId = async_hooks.triggerAsyncId; 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciconst triggerAsyncId0 = triggerAsyncId(); 91cb0ef41Sopenharmony_cilet triggerAsyncId1; 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ciprocess.nextTick(() => { 121cb0ef41Sopenharmony_ci process.nextTick(() => { 131cb0ef41Sopenharmony_ci triggerAsyncId1 = triggerAsyncId(); 141cb0ef41Sopenharmony_ci // Async resources having different causal ancestry 151cb0ef41Sopenharmony_ci // should have different triggerAsyncIds 161cb0ef41Sopenharmony_ci assert.notStrictEqual( 171cb0ef41Sopenharmony_ci triggerAsyncId0, 181cb0ef41Sopenharmony_ci triggerAsyncId1); 191cb0ef41Sopenharmony_ci }); 201cb0ef41Sopenharmony_ci process.nextTick(() => { 211cb0ef41Sopenharmony_ci const triggerAsyncId2 = triggerAsyncId(); 221cb0ef41Sopenharmony_ci // Async resources having the same causal ancestry 231cb0ef41Sopenharmony_ci // should have the same triggerAsyncId 241cb0ef41Sopenharmony_ci assert.strictEqual( 251cb0ef41Sopenharmony_ci triggerAsyncId1, 261cb0ef41Sopenharmony_ci triggerAsyncId2); 271cb0ef41Sopenharmony_ci }); 281cb0ef41Sopenharmony_ci}); 29