MCPcopy Index your code
hub / github.com/nodejs/node / waitInitialBreak

Function waitInitialBreak

test/parallel/test-debugger-exec.js:13–71  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11const cli = startCLI([fixtures.path('debugger/alive.js')]);
12
13async function waitInitialBreak() {
14 try {
15 await cli.waitForInitialBreak();
16 await cli.waitForPrompt();
17 await cli.command('exec [typeof heartbeat, typeof process.exit]');
18 assert.match(cli.output, /\[ 'function', 'function' \]/, 'works w/o paren');
19
20 await cli.command('p [typeof heartbeat, typeof process.exit]');
21 assert.match(
22 cli.output,
23 /\[ 'function', 'function' \]/,
24 'works w/o paren, short'
25 );
26
27 await cli.command('repl');
28 assert.match(
29 cli.output,
30 /Press Ctrl\+C to leave debug repl\n+> /,
31 'shows hint for how to leave repl'
32 );
33 assert.doesNotMatch(cli.output, /debug>/, 'changes the repl style');
34
35 await cli.command('[typeof heartbeat, typeof process.exit]');
36 await cli.waitFor(/function/);
37 await cli.waitForPrompt();
38 assert.match(
39 cli.output,
40 /\[ 'function', 'function' \]/,
41 'can evaluate in the repl'
42 );
43 assert.match(cli.output, /> $/);
44
45 await cli.ctrlC();
46 await cli.waitFor(/debug> $/);
47 await cli.command('exec("[typeof heartbeat, typeof process.exit]")');
48 assert.match(cli.output, /\[ 'function', 'function' \]/, 'works w/ paren');
49 await cli.command('p("[typeof heartbeat, typeof process.exit]")');
50 assert.match(
51 cli.output,
52 /\[ 'function', 'function' \]/,
53 'works w/ paren, short'
54 );
55
56 await cli.command('cont');
57 await cli.command('exec [typeof heartbeat, typeof process.exit]');
58 assert.match(
59 cli.output,
60 /\[ 'undefined', 'function' \]/,
61 'non-paused exec can see global but not module-scope values'
62 );
63
64 // Ref: https://github.com/nodejs/node/issues/46808
65 await cli.waitForPrompt();
66 await cli.command('exec { a: 1 }');
67 assert.match(cli.output, /\{ a: 1 \}/);
68 } finally {
69 await cli.quit();
70 }

Callers 1

Calls 3

commandMethod · 0.80
waitForMethod · 0.80
matchMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…