mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
c0ae3b2373
PR-URL: https://github.com/nodejs/node/pull/52734 Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
29 lines
991 B
JavaScript
29 lines
991 B
JavaScript
import * as common from '../common/index.mjs';
|
|
|
|
common.skipIfInspectorDisabled();
|
|
|
|
import assert from 'node:assert';
|
|
import { NodeInstance } from '../common/inspector-helper.js';
|
|
|
|
|
|
async function runTests() {
|
|
const child = new NodeInstance(['--inspect-wait=0'], 'console.log(0);');
|
|
const session = await child.connectInspectorSession();
|
|
await session.send({ method: 'NodeRuntime.enable' });
|
|
await session.waitForNotification('NodeRuntime.waitingForDebugger');
|
|
|
|
// The execution should be paused until the debugger is attached
|
|
while (await child.nextStderrString() !== 'Debugger attached.');
|
|
|
|
await session.send({ 'method': 'Runtime.runIfWaitingForDebugger' });
|
|
|
|
// Wait for the execution to finish
|
|
while (await child.nextStderrString() !== 'Waiting for the debugger to disconnect...');
|
|
|
|
await session.send({ method: 'NodeRuntime.disable' });
|
|
session.disconnect();
|
|
assert.strictEqual((await child.expectShutdown()).exitCode, 0);
|
|
}
|
|
|
|
runTests().then(common.mustCall());
|