mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00

PR-URL: https://github.com/nodejs/node/pull/58841 Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
31 lines
1 KiB
JavaScript
31 lines
1 KiB
JavaScript
'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();
|
|
});
|