Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: workaround for V8 8.1 inspector pause issue #32234

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions test/fixtures/inspector-global-function.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ global.sum = function() {
console.log(invocations++, c);
};

// NOTE(mmarchini): Calls console.log two times to ensure we loaded every
// internal module before pausing. See
// https://bugs.chromium.org/p/v8/issues/detail?id=10287.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: remove the line end ., so the link can directly clickable

console.log('Loading');
console.log('Ready!');
5 changes: 5 additions & 0 deletions test/parallel/test-inspector-multisession-ws.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ session.on('Debugger.paused', () => {
session.connect();
session.post('Debugger.enable');
console.log('Ready');
console.log('Ready');
`;

async function setupSession(node) {
Expand All @@ -46,6 +47,10 @@ async function testSuspend(sessionA, sessionB) {
await sessionA.waitForNotification('Debugger.paused', 'Initial pause');
sessionA.send({ 'method': 'Debugger.resume' });

await sessionA.waitForNotification('Runtime.consoleAPICalled',
'Console output');
// NOTE(mmarchini): Remove second console.log when
// https://bugs.chromium.org/p/v8/issues/detail?id=10287 is fixed.
await sessionA.waitForNotification('Runtime.consoleAPICalled',
'Console output');
sessionA.send({ 'method': 'Debugger.pause' });
Expand Down
14 changes: 12 additions & 2 deletions test/sequential/test-inspector-break-when-eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ async function setupDebugger(session) {
{ 'method': 'Runtime.runIfWaitingForDebugger' },
];
session.send(commands);
await session.waitForNotification('Runtime.consoleAPICalled');

await session.waitForNotification('Debugger.paused', 'Initial pause');

// NOTE(mmarchini): We wait for the second console.log to ensure we loaded
// every internal module before pausing. See
// https://bugs.chromium.org/p/v8/issues/detail?id=10287.
const waitForReady = session.waitForConsoleOutput('log', 'Ready!');
session.send({ 'method': 'Debugger.resume' });
await waitForReady;
}

async function breakOnLine(session) {
Expand Down Expand Up @@ -56,7 +64,9 @@ async function stepOverConsoleStatement(session) {
}

async function runTests() {
const child = new NodeInstance(['--inspect=0'], undefined, script);
// NOTE(mmarchini): Use --inspect-brk to improve avoid undeterministic
// behavior.
const child = new NodeInstance(['--inspect-brk=0'], undefined, script);
const session = await child.connectInspectorSession();
await setupDebugger(session);
await breakOnLine(session);
Expand Down