Skip to content

Commit 7c88739

Browse files
aduh95marco-ippolito
authored andcommitted
test: fix some tests when path contains %
Tests should pass even if the path where the repo is cloned contains URL-significant chars. PR-URL: #55082 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
1 parent 2be5d61 commit 7c88739

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

test/common/inspector-helper.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ class InspectorSession {
255255
const callFrame = message.params.callFrames[0];
256256
const location = callFrame.location;
257257
const scriptPath = this._scriptsIdsByUrl.get(location.scriptId);
258-
assert.strictEqual(scriptPath.toString(),
259-
expectedScriptPath.toString(),
258+
assert.strictEqual(decodeURIComponent(scriptPath),
259+
decodeURIComponent(expectedScriptPath),
260260
`${scriptPath} !== ${expectedScriptPath}`);
261261
assert.strictEqual(location.lineNumber, line);
262262
return true;

test/es-module/test-esm-import-meta-resolve.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ assert.deepStrictEqual(
4545
{ default: 'some://weird/protocol' },
4646
);
4747
assert.deepStrictEqual(
48-
{ ...await import(`data:text/javascript,export default import.meta.resolve("baz/", ${JSON.stringify(fixtures)})`) },
48+
{ ...await import(`data:text/javascript,export default import.meta.resolve("baz/", ${encodeURIComponent(JSON.stringify(fixtures))})`) },
4949
{ default: fixtures + 'node_modules/baz/' },
5050
);
5151
assert.deepStrictEqual(

test/es-module/test-esm-loader-hooks.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ describe('Loader hooks', { concurrency: true }, () => {
787787
const { code, signal, stdout, stderr } = await spawnPromisified(execPath, [
788788
'--no-warnings',
789789
'--experimental-loader',
790-
`data:text/javascript,const fixtures=${JSON.stringify(fixtures.path('empty.js'))};export ${
790+
`data:text/javascript,const fixtures=${encodeURI(JSON.stringify(fixtures.path('empty.js')))};export ${
791791
encodeURIComponent(function resolve(s, c, n) {
792792
if (s.endsWith('entry-point')) {
793793
return {

0 commit comments

Comments
 (0)