Skip to content

Commit bfbb355

Browse files
committed
test: reduce waitForInitialBreak() flakiness in debugger tests
1 parent 3725bd2 commit bfbb355

29 files changed

+37
-8
lines changed

test/parallel/test-debugger-auto-resume.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ addLibraryPath(process.env);
2323

2424
const cli = startCLI([script], [], { env });
2525

26+
await cli.waitForPrompt();
2627
await cli.waitForInitialBreak();
28+
await cli.waitForPrompt();
2729
assert.deepStrictEqual(cli.breakInfo, {
2830
filename: script,
2931
line: 10,

test/parallel/test-debugger-backtrace.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const path = require('path');
1717

1818
async function runTest() {
1919
try {
20+
await cli.waitForPrompt();
2021
await cli.waitForInitialBreak();
2122
await cli.waitForPrompt();
2223
await cli.stepCommand('c');

test/parallel/test-debugger-break.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const script = path.relative(process.cwd(), scriptFullPath);
1414
const cli = startCLI([script]);
1515

1616
(async () => {
17+
await cli.waitForPrompt();
1718
await cli.waitForInitialBreak();
1819
await cli.waitForPrompt();
1920
assert.deepStrictEqual(

test/parallel/test-debugger-breakpoint-exists.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const cli = startCLI([script]);
1313

1414
(async () => {
1515
try {
16+
await cli.waitForPrompt();
1617
await cli.waitForInitialBreak();
1718
await cli.waitForPrompt();
1819
await cli.command('setBreakpoint(1)');

test/parallel/test-debugger-clear-breakpoints.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ const path = require('path');
2020
throw error;
2121
}
2222

23-
return cli.waitForInitialBreak()
23+
return cli.waitForPrompt()
24+
.then(() => cli.waitForInitialBreak())
2425
.then(() => cli.waitForPrompt())
2526
.then(() => cli.command('sb("break.js", 3)'))
2627
.then(() => cli.command('sb("break.js", 9)'))

test/parallel/test-debugger-exceptions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ const path = require('path');
1717

1818
(async () => {
1919
try {
20-
await cli.waitForInitialBreak();
2120
await cli.waitForPrompt();
21+
await cli.waitForInitialBreak();
2222
await cli.waitForPrompt();
2323
assert.deepStrictEqual(cli.breakInfo, { filename: script, line: 1 });
2424

test/parallel/test-debugger-exec-scope.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import assert from 'assert';
1010
const cli = startCLI([fixtures.path('debugger/backtrace.js')]);
1111

1212
try {
13+
await cli.waitForPrompt();
1314
await cli.waitForInitialBreak();
1415
await cli.waitForPrompt();
1516
await cli.stepCommand('c');

test/parallel/test-debugger-exec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const cli = startCLI([fixtures.path('debugger/alive.js')]);
1212

1313
async function waitInitialBreak() {
1414
try {
15+
await cli.waitForPrompt();
1516
await cli.waitForInitialBreak();
1617
await cli.waitForPrompt();
1718
await cli.command('exec [typeof heartbeat, typeof process.exit]');

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import assert from 'assert';
1010
const cli = startCLI([fixtures.path('debugger', 'three-lines.js')]);
1111

1212
try {
13+
await cli.waitForPrompt();
1314
await cli.waitForInitialBreak();
1415
await cli.waitForPrompt();
1516
await cli.command('exec a = function func() {}; a;');

test/parallel/test-debugger-heap-profiler.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const filename = tmpdir.resolve('node.heapsnapshot');
2020

2121
async function waitInitialBreak() {
2222
try {
23+
await cli.waitForPrompt();
2324
await cli.waitForInitialBreak();
2425
await cli.waitForPrompt();
2526
await cli.command('takeHeapSnapshot()');

0 commit comments

Comments
 (0)