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: https://github.com/nodejs/node/pull/66231
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
Filip Skokan authored and GitHub committed 2026-09-26 07:57:16 +00:00
1 parent 4889fb0a43
commit 45fef372fc
1 file changed
+5 -7
@@ -7,14 +7,12 @@ import startCLI from '../common/debugger.js';
import assert from 'assert';
const env = {
...process.env,
NODE_INSPECT_RESUME_ON_START: '1',
};
const cli = startCLI(
[fixtures.path('debugger', 'alive.js')], [], { env });
// Evaluating while the target is running can trigger a V8 scope assertion.
// Keep it paused for these formatting checks.
const cli = startCLI([fixtures.path('debugger', 'three-lines.js')]);
try {
await cli.waitForInitialBreak();
await cli.waitForPrompt();
await cli.command('exec a = function func() {}; a;');
assert.match(cli.output, /\[Function: func\]/);
@@ -33,5 +31,5 @@ try {
await cli.command('exec a = function * func() {}; a;');
assert.match(cli.output, /\[GeneratorFunction\]/);
} finally {
cli.quit();
await cli.quit();
}