From afc3455c9d1b78c5cfa8b7cf5b36335fb8c963f3 Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Mon, 15 Jun 2026 20:59:46 -0700 Subject: [PATCH] test: fix debugger probe throwing getter flake Move the probe target statements into the fixture interval so they remain available if breakpoint binding happens after the script first runs. This preserves the throwing-expression coverage without depending on two adjacent top-level statements being hit during startup. Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com> Assisted-by: openai:gpt-5.5 --- test/fixtures/debugger/probe-throwing-getter.js | 7 ++++--- .../test-debugger-probe-expression-throws.js | 12 ++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/test/fixtures/debugger/probe-throwing-getter.js b/test/fixtures/debugger/probe-throwing-getter.js index 906e464f98dd87..9ba86589a8b592 100644 --- a/test/fixtures/debugger/probe-throwing-getter.js +++ b/test/fixtures/debugger/probe-throwing-getter.js @@ -13,9 +13,10 @@ function markProbesDone() { module.exports = { holder, markProbesDone }; -globalThis.probeLine1 = 1; -globalThis.probeLine2 = 2; - const interval = setInterval(() => { + // Keep these module bindings visible to probe evaluation from this callback. + void holder; void markProbesDone; + globalThis.probeLine1 = 1; + globalThis.probeLine2 = 2; if (probesDone) clearInterval(interval); }, 50); diff --git a/test/parallel/test-debugger-probe-expression-throws.js b/test/parallel/test-debugger-probe-expression-throws.js index 97c5e94d0485e2..9efa0a61a77ec3 100644 --- a/test/parallel/test-debugger-probe-expression-throws.js +++ b/test/parallel/test-debugger-probe-expression-throws.js @@ -12,16 +12,16 @@ const { assertProbeJson } = require('../common/debugger-probe'); const cwd = fixtures.path('debugger'); const fixture = 'probe-throwing-getter.js'; const probes = [ - { expr: 'holder.throwingGetter', target: { suffix: fixture, line: 16 } }, + { expr: 'holder.throwingGetter', target: { suffix: fixture, line: 19 } }, // This clears the interval so the process will exit naturally. - { expr: 'markProbesDone()', target: { suffix: fixture, line: 17 } }, + { expr: 'markProbesDone()', target: { suffix: fixture, line: 20 } }, ]; const url = fixtures.fileURL('debugger', fixture).href; spawnSyncAndExit(process.execPath, [ 'inspect', '--json', - '--probe', `${fixture}:16`, '--expr', probes[0].expr, - '--probe', `${fixture}:17`, '--expr', probes[1].expr, + '--probe', `${fixture}:19`, '--expr', probes[0].expr, + '--probe', `${fixture}:20`, '--expr', probes[1].expr, fixture, ], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, { status: 0, @@ -34,7 +34,7 @@ spawnSyncAndExit(process.execPath, [ probe: 0, event: 'hit', hit: 1, - location: { url, line: 16, column: 1 }, + location: { url, line: 19, column: 3 }, error: { message: 'Error: boom\n', details: { @@ -53,7 +53,7 @@ spawnSyncAndExit(process.execPath, [ probe: 1, event: 'hit', hit: 1, - location: { url, line: 17, column: 1 }, + location: { url, line: 20, column: 3 }, result: { type: 'undefined' }, }, { event: 'completed',