Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix improper path to URL conversion #54509

Merged
merged 1 commit into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion test/fixtures/permission/fs-read.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ const common = require('../../common');
const assert = require('assert');
const fs = require('fs');
const path = require('path');
const { pathToFileURL } = require('url');

const blockedFile = process.env.BLOCKEDFILE;
const bufferBlockedFile = Buffer.from(process.env.BLOCKEDFILE);
const blockedFileURL = new URL('file://' + process.env.BLOCKEDFILE);
const blockedFileURL = pathToFileURL(process.env.BLOCKEDFILE);
const blockedFolder = process.env.BLOCKEDFOLDER;
const allowedFolder = process.env.ALLOWEDFOLDER;
const regularFile = __filename;
Expand Down
6 changes: 2 additions & 4 deletions test/parallel/test-diagnostics-channel-module-import-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
const common = require('../common');
const assert = require('assert');
const dc = require('diagnostics_channel');
const { pathToFileURL } = require('url');

const trace = dc.tracingChannel('module.import');
const events = [];
Expand Down Expand Up @@ -30,10 +31,7 @@ trace.subscribe({
import('does-not-exist').then(
common.mustNotCall(),
common.mustCall((error) => {
let expectedParentURL = module.filename.replaceAll('\\', '/');
expectedParentURL = common.isWindows ?
`file:///${expectedParentURL}` :
`file://${expectedParentURL}`;
const expectedParentURL = pathToFileURL(module.filename).href;
// Verify order and contents of each event
assert.deepStrictEqual(events, [
{
Expand Down
6 changes: 2 additions & 4 deletions test/parallel/test-diagnostics-channel-module-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
const common = require('../common');
const assert = require('assert');
const dc = require('diagnostics_channel');
const { pathToFileURL } = require('url');

const trace = dc.tracingChannel('module.import');
const events = [];
Expand Down Expand Up @@ -29,10 +30,7 @@ trace.subscribe({

import('http').then(
common.mustCall((result) => {
let expectedParentURL = module.filename.replaceAll('\\', '/');
expectedParentURL = common.isWindows ?
`file:///${expectedParentURL}` :
`file://${expectedParentURL}`;
const expectedParentURL = pathToFileURL(module.filename).href;
// Verify order and contents of each event
assert.deepStrictEqual(events, [
{
Expand Down
Loading