test: fix a bug & lint issues in inspector-helper
PR-URL: https://github.com/nodejs/node/pull/18293 Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com>
This commit is contained in:
parent
e7ff00d0c5
commit
a3555d0583
@ -5,9 +5,8 @@ const fs = require('fs');
|
|||||||
const http = require('http');
|
const http = require('http');
|
||||||
const fixtures = require('../common/fixtures');
|
const fixtures = require('../common/fixtures');
|
||||||
const { spawn } = require('child_process');
|
const { spawn } = require('child_process');
|
||||||
const { URL, parse: parseURL } = require('url');
|
const { parse: parseURL } = require('url');
|
||||||
const { getURLFromFilePath } = require('internal/url');
|
const { getURLFromFilePath } = require('internal/url');
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
const _MAINSCRIPT = fixtures.path('loop.js');
|
const _MAINSCRIPT = fixtures.path('loop.js');
|
||||||
const DEBUG = false;
|
const DEBUG = false;
|
||||||
@ -173,7 +172,9 @@ class InspectorSession {
|
|||||||
const scriptId = script['scriptId'];
|
const scriptId = script['scriptId'];
|
||||||
const url = script['url'];
|
const url = script['url'];
|
||||||
this._scriptsIdsByUrl.set(scriptId, 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;
|
this.mainScriptId = scriptId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -246,8 +247,9 @@ class InspectorSession {
|
|||||||
const callFrame = message['params']['callFrames'][0];
|
const callFrame = message['params']['callFrames'][0];
|
||||||
const location = callFrame['location'];
|
const location = callFrame['location'];
|
||||||
const scriptPath = this._scriptsIdsByUrl.get(location['scriptId']);
|
const scriptPath = this._scriptsIdsByUrl.get(location['scriptId']);
|
||||||
assert(scriptPath.toString() === expectedScriptPath.toString(),
|
assert.strictEqual(scriptPath.toString(),
|
||||||
`${scriptPath} !== ${expectedScriptPath}`);
|
expectedScriptPath.toString(),
|
||||||
|
`${scriptPath} !== ${expectedScriptPath}`);
|
||||||
assert.strictEqual(line, location['lineNumber']);
|
assert.strictEqual(line, location['lineNumber']);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user