Skip to content

Commit 19abee1

Browse files
apapirovskiMylesBorins
authored andcommitted
test: fix a bug & lint issues in inspector-helper
PR-URL: #18293 Reviewed-By: Eugene Ostroukhov <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Guy Bedford <[email protected]>
1 parent 74051c6 commit 19abee1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

test/common/inspector-helper.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ const fs = require('fs');
55
const http = require('http');
66
const fixtures = require('../common/fixtures');
77
const { spawn } = require('child_process');
8-
const { URL, parse: parseURL } = require('url');
8+
const { parse: parseURL } = require('url');
99
const { getURLFromFilePath } = require('internal/url');
10-
const path = require('path');
1110

1211
const _MAINSCRIPT = fixtures.path('loop.js');
1312
const DEBUG = false;
@@ -173,7 +172,9 @@ class InspectorSession {
173172
const scriptId = script['scriptId'];
174173
const url = script['url'];
175174
this._scriptsIdsByUrl.set(scriptId, url);
176-
if (getURLFromFilePath(url).toString() === this.scriptURL().toString()) {
175+
const fileUrl = url.startsWith('file:') ?
176+
url : getURLFromFilePath(url).toString();
177+
if (fileUrl === this.scriptURL().toString()) {
177178
this.mainScriptId = scriptId;
178179
}
179180
}
@@ -246,8 +247,9 @@ class InspectorSession {
246247
const callFrame = message['params']['callFrames'][0];
247248
const location = callFrame['location'];
248249
const scriptPath = this._scriptsIdsByUrl.get(location['scriptId']);
249-
assert(scriptPath.toString() === expectedScriptPath.toString(),
250-
`${scriptPath} !== ${expectedScriptPath}`);
250+
assert.strictEqual(scriptPath.toString(),
251+
expectedScriptPath.toString(),
252+
`${scriptPath} !== ${expectedScriptPath}`);
251253
assert.strictEqual(line, location['lineNumber']);
252254
return true;
253255
}

0 commit comments

Comments
 (0)