Skip to content

Commit fdae57f

Browse files
aduh95targos
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 <luigipinca@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
1 parent 4352d9c commit fdae57f

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
@@ -822,7 +822,7 @@ describe('Loader hooks', { concurrency: !process.env.TEST_PARALLEL }, () => {
822822
const { code, signal, stdout, stderr } = await spawnPromisified(execPath, [
823823
'--no-warnings',
824824
'--experimental-loader',
825-
`data:text/javascript,const fixtures=${JSON.stringify(fixtures.path('empty.js'))};export ${
825+
`data:text/javascript,const fixtures=${encodeURI(JSON.stringify(fixtures.path('empty.js')))};export ${
826826
encodeURIComponent(function resolve(s, c, n) {
827827
if (s.endsWith('entry-point')) {
828828
return {

0 commit comments

Comments
 (0)