Skip to content

Commit 45fef37

Browse files
authored
test: deflake debugger function name extraction
Evaluating expressions against the running target can trigger a V8 scope assertion. Keep the target paused and wait for the initial break before checking the function formatting. Await debugger teardown. Signed-off-by: Filip Skokan <panva.ip@gmail.com> Assisted-by: Codex PR-URL: #66231 Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 4889fb0 commit 45fef37

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

‎test/parallel/test-debugger-extract-function-name.mjs‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ import startCLI from '../common/debugger.js';
77

88
import assert from 'assert';
99

10-
const env = {
11-
...process.env,
12-
NODE_INSPECT_RESUME_ON_START: '1',
13-
};
14-
const cli = startCLI(
15-
[fixtures.path('debugger', 'alive.js')], [], { env });
10+
// Evaluating while the target is running can trigger a V8 scope assertion.
11+
// Keep it paused for these formatting checks.
12+
const cli = startCLI([fixtures.path('debugger', 'three-lines.js')]);
1613

1714
try {
15+
await cli.waitForInitialBreak();
1816
await cli.waitForPrompt();
1917
await cli.command('exec a = function func() {}; a;');
2018
assert.match(cli.output, /\[Function: func\]/);
@@ -33,5 +31,5 @@ try {
3331
await cli.command('exec a = function * func() {}; a;');
3432
assert.match(cli.output, /\[GeneratorFunction\]/);
3533
} finally {
36-
cli.quit();
34+
await cli.quit();
3735
}

0 commit comments

Comments
 (0)