Skip to content

Commit 67c068f

Browse files
committed
test: relax debugger attach sync in tests
1 parent c9d0ef8 commit 67c068f

File tree

3 files changed

+35
-11
lines changed

3 files changed

+35
-11
lines changed

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

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,46 @@ import assert from 'assert';
1010
const cli = startCLI([fixtures.path('debugger', 'three-lines.js')]);
1111

1212
try {
13-
await cli.waitForInitialBreak();
13+
await cli.waitFor(/Debugger attached\./);
14+
await cli.waitForPrompt();
15+
cli.writeLine('exec a = function func() {}; a;', true);
16+
await cli.waitFor(/\[Function: func\]/);
1417
await cli.waitForPrompt();
15-
await cli.command('exec a = function func() {}; a;');
1618
assert.match(cli.output, /\[Function: func\]/);
17-
await cli.command('exec a = function func () {}; a;');
19+
20+
cli.writeLine('exec a = function func () {}; a;', true);
21+
await cli.waitFor(/\[Function\]/);
22+
await cli.waitForPrompt();
1823
assert.match(cli.output, /\[Function\]/);
19-
await cli.command('exec a = function() {}; a;');
24+
25+
cli.writeLine('exec a = function() {}; a;', true);
26+
await cli.waitFor(/\[Function: function\]/);
27+
await cli.waitForPrompt();
2028
assert.match(cli.output, /\[Function: function\]/);
21-
await cli.command('exec a = () => {}; a;');
29+
30+
cli.writeLine('exec a = () => {}; a;', true);
31+
await cli.waitFor(/\[Function\]/);
32+
await cli.waitForPrompt();
2233
assert.match(cli.output, /\[Function\]/);
23-
await cli.command('exec a = function* func() {}; a;');
34+
35+
cli.writeLine('exec a = function* func() {}; a;', true);
36+
await cli.waitFor(/\[GeneratorFunction: func\]/);
37+
await cli.waitForPrompt();
2438
assert.match(cli.output, /\[GeneratorFunction: func\]/);
25-
await cli.command('exec a = function *func() {}; a;');
39+
40+
cli.writeLine('exec a = function *func() {}; a;', true);
41+
await cli.waitFor(/\[GeneratorFunction: \*func\]/);
42+
await cli.waitForPrompt();
2643
assert.match(cli.output, /\[GeneratorFunction: \*func\]/);
27-
await cli.command('exec a = function*func() {}; a;');
44+
45+
cli.writeLine('exec a = function*func() {}; a;', true);
46+
await cli.waitFor(/\[GeneratorFunction: function\*func\]/);
47+
await cli.waitForPrompt();
2848
assert.match(cli.output, /\[GeneratorFunction: function\*func\]/);
29-
await cli.command('exec a = function * func() {}; a;');
49+
50+
cli.writeLine('exec a = function * func() {}; a;', true);
51+
await cli.waitFor(/\[GeneratorFunction\]/);
52+
await cli.waitForPrompt();
3053
assert.match(cli.output, /\[GeneratorFunction\]/);
3154
} finally {
3255
cli.quit();

test/parallel/test-debugger-random-port-with-inspect-port.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const script = fixtures.path('debugger', 'three-lines.js');
1313
const cli = startCLI(['--inspect-port=0', script], [], {}, { randomPort: false });
1414

1515
(async () => {
16-
await cli.waitForInitialBreak();
16+
await cli.waitFor(/Debugger attached\./);
1717
await cli.waitForPrompt();
1818
assert.match(cli.output, /debug>/, 'prints a prompt');
1919
assert.match(

test/parallel/test-debugger-watch-validation.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ const assert = require('assert');
1111
const cli = startCLI([fixtures.path('debugger/break.js')]);
1212

1313
(async () => {
14-
await cli.waitForInitialBreak();
14+
await cli.waitFor(/Debugger attached\./);
15+
await cli.waitForPrompt();
1516
await cli.command('watch()');
1617
await cli.waitFor(/ERR_INVALID_ARG_TYPE/);
1718
assert.match(cli.output, /TypeError \[ERR_INVALID_ARG_TYPE\]: The "expression" argument must be of type string\. Received undefined/);

0 commit comments

Comments
 (0)