GeezerVison is showing github.com — test: workaround for V8 8.1 inspector pause issue · nodejs/node@92a207c
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: test/fixtures/inspector-global-function.js +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -10,4 +10,8 @@ global.sum = function() { |
10 | 10 | console.log(invocations++, c); |
11 | 11 | }; |
12 | 12 |
|
| 13 | +// NOTE(mmarchini): Calls console.log two times to ensure we loaded every |
| 14 | +// internal module before pausing. See |
| 15 | +// https://bugs.chromium.org/p/v8/issues/detail?id=10287. |
| 16 | +console.log('Loading'); |
13 | 17 | console.log('Ready!'); |
Collapse file
Copy file name to clipboardExpand all lines: test/parallel/test-inspector-multisession-ws.js +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -20,6 +20,7 @@ session.on('Debugger.paused', () => { |
20 | 20 | session.connect(); |
21 | 21 | session.post('Debugger.enable'); |
22 | 22 | console.log('Ready'); |
| 23 | +console.log('Ready'); |
23 | 24 | `; |
24 | 25 |
|
25 | 26 | async function setupSession(node) { |
@@ -46,6 +47,10 @@ async function testSuspend(sessionA, sessionB) { |
46 | 47 | await sessionA.waitForNotification('Debugger.paused', 'Initial pause'); |
47 | 48 | sessionA.send({ 'method': 'Debugger.resume' }); |
48 | 49 |
|
| 50 | + await sessionA.waitForNotification('Runtime.consoleAPICalled', |
| 51 | + 'Console output'); |
| 52 | + // NOTE(mmarchini): Remove second console.log when |
| 53 | + // https://bugs.chromium.org/p/v8/issues/detail?id=10287 is fixed. |
49 | 54 | await sessionA.waitForNotification('Runtime.consoleAPICalled', |
50 | 55 | 'Console output'); |
51 | 56 | sessionA.send({ 'method': 'Debugger.pause' }); |
|
Collapse file
Copy file name to clipboardExpand all lines: test/sequential/test-inspector-break-when-eval.js +12-2Lines changed: 12 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -18,7 +18,15 @@ async function setupDebugger(session) { |
18 | 18 | { 'method': 'Runtime.runIfWaitingForDebugger' }, |
19 | 19 | ]; |
20 | 20 | session.send(commands); |
21 | | - await session.waitForNotification('Runtime.consoleAPICalled'); |
| 21 | + |
| 22 | + await session.waitForNotification('Debugger.paused', 'Initial pause'); |
| 23 | + |
| 24 | + // NOTE(mmarchini): We wait for the second console.log to ensure we loaded |
| 25 | + // every internal module before pausing. See |
| 26 | + // https://bugs.chromium.org/p/v8/issues/detail?id=10287. |
| 27 | + const waitForReady = session.waitForConsoleOutput('log', 'Ready!'); |
| 28 | + session.send({ 'method': 'Debugger.resume' }); |
| 29 | + await waitForReady; |
22 | 30 | } |
23 | 31 |
|
24 | 32 | async function breakOnLine(session) { |
@@ -56,7 +64,9 @@ async function stepOverConsoleStatement(session) { |
56 | 64 | } |
57 | 65 |
|
58 | 66 | async function runTests() { |
59 | | - const child = new NodeInstance(['--inspect=0'], undefined, script); |
| 67 | + // NOTE(mmarchini): Use --inspect-brk to improve avoid undeterministic |
| 68 | + // behavior. |
| 69 | + const child = new NodeInstance(['--inspect-brk=0'], undefined, script); |
60 | 70 | const session = await child.connectInspectorSession(); |
61 | 71 | await setupDebugger(session); |
62 | 72 | await breakOnLine(session); |
|