2017-07-24 16:23:04 +00:00
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
|
|
|
|
common.skipIfInspectorDisabled();
|
|
|
|
|
|
|
|
const assert = require('assert');
|
2018-01-16 22:35:54 +00:00
|
|
|
const { NodeInstance } = require('../common/inspector-helper.js');
|
2017-07-24 16:23:04 +00:00
|
|
|
|
|
|
|
async function testBreakpointOnStart(session) {
|
|
|
|
const commands = [
|
|
|
|
{ 'method': 'Runtime.enable' },
|
|
|
|
{ 'method': 'Debugger.enable' },
|
|
|
|
{ 'method': 'Debugger.setPauseOnExceptions',
|
|
|
|
'params': { 'state': 'none' } },
|
|
|
|
{ 'method': 'Debugger.setAsyncCallStackDepth',
|
|
|
|
'params': { 'maxDepth': 0 } },
|
|
|
|
{ 'method': 'Profiler.enable' },
|
|
|
|
{ 'method': 'Profiler.setSamplingInterval',
|
|
|
|
'params': { 'interval': 100 } },
|
|
|
|
{ 'method': 'Debugger.setBlackboxPatterns',
|
|
|
|
'params': { 'patterns': [] } },
|
2021-03-26 15:51:08 +00:00
|
|
|
{ 'method': 'Runtime.runIfWaitingForDebugger' },
|
2017-07-24 16:23:04 +00:00
|
|
|
];
|
|
|
|
|
2024-02-23 22:46:29 +00:00
|
|
|
await session.send({ method: 'NodeRuntime.enable' });
|
|
|
|
await session.waitForNotification('NodeRuntime.waitingForDebugger');
|
|
|
|
await session.send(commands);
|
|
|
|
await session.send({ method: 'NodeRuntime.disable' });
|
2018-08-30 21:59:34 +00:00
|
|
|
await session.waitForBreakOnLine(0, session.scriptURL());
|
2017-07-24 16:23:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
async function runTests() {
|
2023-04-04 23:20:49 +00:00
|
|
|
const child = new NodeInstance(['--inspect-brk=0']);
|
2017-07-24 16:23:04 +00:00
|
|
|
const session = await child.connectInspectorSession();
|
|
|
|
|
|
|
|
await testBreakpointOnStart(session);
|
|
|
|
await session.runToCompletion();
|
|
|
|
|
2018-10-12 16:55:48 +00:00
|
|
|
assert.strictEqual((await child.expectShutdown()).exitCode, 55);
|
2017-07-24 16:23:04 +00:00
|
|
|
}
|
|
|
|
|
2020-04-05 20:27:46 +00:00
|
|
|
runTests().then(common.mustCall());
|