node/test/parallel/test-debugger-probe-startup-pause.js
Trivikram Kamat 1a33a8c06e
debugger: defer probe pause handling until startup
Keep the initial --inspect-brk pause held until probe breakpoints are
bound and probe mode explicitly releases the target. This prevents the
generic pause handler from resuming user code before probes are ready.

Refs: https://github.com/nodejs/node/actions/runs/26482141780/job/77981519238

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63608
Refs: https://github.com/nodejs/node/actions/runs/26482141780/job/77981519238
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
2026-06-18 04:24:28 +00:00

32 lines
806 B
JavaScript

// Flags: --expose-internals
// This tests that probe mode ignores pauses until startup has finished binding
// breakpoints.
'use strict';
const common = require('../common');
common.skipIfInspectorDisabled();
const assert = require('assert');
const { ProbeInspectorSession } = require('internal/debugger/inspect_probe');
const session = new ProbeInspectorSession({
probes: [],
});
const cdpCalls = [];
session.client = {
callMethod: common.mustCall(async (method) => {
cdpCalls.push(method);
}),
};
async function testStartupPauseHandling() {
await session.handlePaused({});
assert.deepStrictEqual(cdpCalls, []);
session.started = true;
await session.handlePaused({});
assert.deepStrictEqual(cdpCalls, ['Debugger.resume']);
}
testStartupPauseHandling().then(common.mustCall());