We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f27a254 commit e2a801aCopy full SHA for e2a801a
test/parallel/test-async-hooks-async-await.js
@@ -0,0 +1,26 @@
1
+// Test async-hooks fired on right
2
+// asyncIds & triggerAsyncId for async-await
3
+'use strict';
4
+
5
+require('../common');
6
+const async_hooks = require('async_hooks');
7
+const assert = require('assert');
8
9
+const asyncIds = [];
10
+async_hooks.createHook({
11
+ init: (asyncId, type, triggerAsyncId) => {
12
+ asyncIds.push([triggerAsyncId, asyncId]);
13
+ }
14
+}).enable();
15
16
+async function main() {
17
+ await null;
18
+}
19
20
+main().then(() => {
21
+ // Verify the relationships between async ids
22
+ // 1 => 2, 2 => 3 etc
23
+ assert.strictEqual(asyncIds[0][1], asyncIds[1][0]);
24
+ assert.strictEqual(asyncIds[0][1], asyncIds[3][0]);
25
+ assert.strictEqual(asyncIds[1][1], asyncIds[2][0]);
26
+});
0 commit comments