summaryrefslogtreecommitdiff
path: root/test/addons/async-hooks-id/test.js
blob: e6c3cf612cacd5dff59a6cb6acde40f729f18809 (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
'use strict';

const common = require('../../common');
const assert = require('assert');
const binding = require(`./build/${common.buildType}/binding`);
const async_hooks = require('async_hooks');

assert.strictEqual(
  binding.getExecutionAsyncId(),
  async_hooks.executionAsyncId()
);
assert.strictEqual(
  binding.getTriggerAsyncId(),
  async_hooks.triggerAsyncId()
);

process.nextTick(common.mustCall(function() {
  assert.strictEqual(
    binding.getExecutionAsyncId(),
    async_hooks.executionAsyncId()
  );
  assert.strictEqual(
    binding.getTriggerAsyncId(),
    async_hooks.triggerAsyncId()
  );
}));