0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-async-wrap-trigger-id.js
Andreas Madsen de762b71f2
async_hooks: rename currentId and triggerId
currentId is renamed to executionAsyncId
triggerId is renamed to triggerAsyncId
AsyncResource.triggerId is renamed to AsyncResource.triggerAsyncId
AsyncHooksGetCurrentId is renamed to AsyncHooksGetExecutionAsyncId
AsyncHooksGetTriggerId is renamed to AsyncHooksGetTriggerAsyncId

PR-URL: https://github.com/nodejs/node/pull/13490
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2017-06-14 12:39:53 +02:00

29 lines
768 B
JavaScript

'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');
});
});