Skip to content

Commit

Permalink
test: fix some tests when path contains %
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
aduh95 authored and targos committed Oct 4, 2024
1 parent 4352d9c commit fdae57f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions test/common/inspector-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ class InspectorSession {
const callFrame = message.params.callFrames[0];
const location = callFrame.location;
const scriptPath = this._scriptsIdsByUrl.get(location.scriptId);
assert.strictEqual(scriptPath.toString(),
expectedScriptPath.toString(),
assert.strictEqual(decodeURIComponent(scriptPath),
decodeURIComponent(expectedScriptPath),
`${scriptPath} !== ${expectedScriptPath}`);
assert.strictEqual(location.lineNumber, line);
return true;
Expand Down
2 changes: 1 addition & 1 deletion test/es-module/test-esm-import-meta-resolve.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ assert.deepStrictEqual(
{ default: 'some://weird/protocol' },
);
assert.deepStrictEqual(
{ ...await import(`data:text/javascript,export default import.meta.resolve("baz/", ${JSON.stringify(fixtures)})`) },
{ ...await import(`data:text/javascript,export default import.meta.resolve("baz/", ${encodeURIComponent(JSON.stringify(fixtures))})`) },
{ default: fixtures + 'node_modules/baz/' },
);
assert.deepStrictEqual(
Expand Down
2 changes: 1 addition & 1 deletion test/es-module/test-esm-loader-hooks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ describe('Loader hooks', { concurrency: !process.env.TEST_PARALLEL }, () => {
const { code, signal, stdout, stderr } = await spawnPromisified(execPath, [
'--no-warnings',
'--experimental-loader',
`data:text/javascript,const fixtures=${JSON.stringify(fixtures.path('empty.js'))};export ${
`data:text/javascript,const fixtures=${encodeURI(JSON.stringify(fixtures.path('empty.js')))};export ${
encodeURIComponent(function resolve(s, c, n) {
if (s.endsWith('entry-point')) {
return {
Expand Down

0 comments on commit fdae57f

Please sign in to comment.