mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
c8a27a7617
The actual bug was fixed by a V8 update in Node v10.4.0. See: https://github.com/nodejs/node/pull/19989 PR-URL: https://github.com/nodejs/node/pull/22374 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
27 lines
650 B
JavaScript
27 lines
650 B
JavaScript
// Test async-hooks fired on right
|
|
// asyncIds & triggerAsyncId for async-await
|
|
'use strict';
|
|
|
|
require('../common');
|
|
const async_hooks = require('async_hooks');
|
|
const assert = require('assert');
|
|
|
|
const asyncIds = [];
|
|
async_hooks.createHook({
|
|
init: (asyncId, type, triggerAsyncId) => {
|
|
asyncIds.push([triggerAsyncId, asyncId]);
|
|
}
|
|
}).enable();
|
|
|
|
async function main() {
|
|
await null;
|
|
}
|
|
|
|
main().then(() => {
|
|
// Verify the relationships between async ids
|
|
// 1 => 2, 2 => 3 etc
|
|
assert.strictEqual(asyncIds[0][1], asyncIds[1][0]);
|
|
assert.strictEqual(asyncIds[0][1], asyncIds[3][0]);
|
|
assert.strictEqual(asyncIds[1][1], asyncIds[2][0]);
|
|
});
|