-
-
Notifications
You must be signed in to change notification settings - Fork 35.7k
Expand file tree
/
Copy pathtest-inspector-debug-async-hook.js
More file actions
31 lines (28 loc) · 1 KB
/
test-inspector-debug-async-hook.js
File metadata and controls
31 lines (28 loc) · 1 KB
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
27
28
29
30
31
'use strict';
const common = require('../common');
common.skipIfInspectorDisabled();
const test = require('node:test');
const { NodeInstance } = require('../common/inspector-helper');
const script = `
import { createHook } from "async_hooks"
import fs from "fs"
const hook = createHook({
after() {
}
});
hook.enable(true);
console.log('Async hook enabled');
`;
test('inspector async hooks should not crash in debug build', async () => {
const instance = new NodeInstance([
'--inspect-brk=0',
], script);
const session = await instance.connectInspectorSession();
await session.send({ method: 'NodeRuntime.enable' });
await session.waitForNotification('NodeRuntime.waitingForDebugger');
await session.send({ method: 'Runtime.enable' });
await session.send({ method: 'Debugger.enable' });
await session.send({ id: 6, method: 'Debugger.setAsyncCallStackDepth', params: { maxDepth: 32 } });
await session.send({ method: 'Runtime.runIfWaitingForDebugger' });
await session.waitForDisconnect();
});