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

inspector: do not hardcode Debugger.CallFrameId in tests #35570

Closed
wants to merge 1 commit into from
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions test/common/inspector-helper.js
Expand Up @@ -130,6 +130,7 @@ class InspectorSession {
this._unprocessedNotifications = [];
this._notificationCallback = null;
this._scriptsIdsByUrl = new Map();
this._pausedDetails = null;

let buffer = Buffer.alloc(0);
socket.on('data', (data) => {
Expand Down Expand Up @@ -179,6 +180,10 @@ class InspectorSession {
this.mainScriptId = scriptId;
}
}
if (message.method === 'Debugger.paused')
this._pausedDetails = message.params;
if (message.method === 'Debugger.resumed')
this._pausedDetails = null;

if (this._notificationCallback) {
// In case callback needs to install another
Expand Down Expand Up @@ -267,6 +272,10 @@ class InspectorSession {
`break on ${url}:${line}`);
}

pausedDetails() {
return this._pausedDetails;
}

_matchesConsoleOutputNotification(notification, type, values) {
if (!Array.isArray(values))
values = [ values ];
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-inspector-esm.js
Expand Up @@ -78,7 +78,7 @@ async function testBreakpoint(session) {

let { result } = await session.send({
'method': 'Debugger.evaluateOnCallFrame', 'params': {
'callFrameId': '{"ordinal":0,"injectedScriptId":1}',
'callFrameId': session.pausedDetails().callFrames[0].callFrameId,
'expression': 'k + t',
'objectGroup': 'console',
'includeCommandLineAPI': true,
Expand Down
6 changes: 3 additions & 3 deletions test/sequential/test-inspector.js
Expand Up @@ -116,7 +116,7 @@ async function testBreakpoint(session) {

let { result } = await session.send({
'method': 'Debugger.evaluateOnCallFrame', 'params': {
'callFrameId': '{"ordinal":0,"injectedScriptId":1}',
'callFrameId': session.pausedDetails().callFrames[0].callFrameId,
'expression': 'k + t',
'objectGroup': 'console',
'includeCommandLineAPI': true,
Expand Down Expand Up @@ -150,7 +150,7 @@ async function testI18NCharacters(session) {
const chars = 'טֶ字и';
session.send({
'method': 'Debugger.evaluateOnCallFrame', 'params': {
'callFrameId': '{"ordinal":0,"injectedScriptId":1}',
'callFrameId': session.pausedDetails().callFrames[0].callFrameId,
'expression': `console.log("${chars}")`,
'objectGroup': 'console',
'includeCommandLineAPI': true,
Expand Down Expand Up @@ -276,7 +276,7 @@ async function testCommandLineAPI(session) {
result = await session.send(
{
'method': 'Debugger.evaluateOnCallFrame', 'params': {
'callFrameId': '{"ordinal":0,"injectedScriptId":1}',
'callFrameId': session.pausedDetails().callFrames[0].callFrameId,
'expression': `(
require(${printBModuleStr}),
require.cache[${printBModuleStr}].parent.id
Expand Down