Skip to content

Commit

Permalink
test: fix a bug & lint issues in inspector-helper
Browse files Browse the repository at this point in the history
PR-URL: #18293
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
  • Loading branch information
apapirovski authored and MylesBorins committed Feb 20, 2018
1 parent a7a712b commit 130d6f3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/common/inspector-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ const fs = require('fs');
const http = require('http');
const fixtures = require('../common/fixtures');
const { spawn } = require('child_process');
const { URL, parse: parseURL } = require('url');
const { parse: parseURL } = require('url');
const { getURLFromFilePath } = require('internal/url');
const path = require('path');

const _MAINSCRIPT = fixtures.path('loop.js');
const DEBUG = false;
Expand Down Expand Up @@ -173,7 +172,9 @@ class InspectorSession {
const scriptId = script['scriptId'];
const url = script['url'];
this._scriptsIdsByUrl.set(scriptId, url);
if (getURLFromFilePath(url).toString() === this.scriptURL().toString()) {
const fileUrl = url.startsWith('file:') ?
url : getURLFromFilePath(url).toString();
if (fileUrl === this.scriptURL().toString()) {
this.mainScriptId = scriptId;
}
}
Expand Down Expand Up @@ -246,8 +247,9 @@ class InspectorSession {
const callFrame = message['params']['callFrames'][0];
const location = callFrame['location'];
const scriptPath = this._scriptsIdsByUrl.get(location['scriptId']);
assert(scriptPath.toString() === expectedScriptPath.toString(),
`${scriptPath} !== ${expectedScriptPath}`);
assert.strictEqual(scriptPath.toString(),
expectedScriptPath.toString(),
`${scriptPath} !== ${expectedScriptPath}`);
assert.strictEqual(line, location['lineNumber']);
return true;
}
Expand Down

0 comments on commit 130d6f3

Please sign in to comment.