mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
test: fix improper path to URL conversion
PR-URL: https://github.com/nodejs/node/pull/54509 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
c062b5242a
commit
4e68b541fd
3
test/fixtures/permission/fs-read.js
vendored
3
test/fixtures/permission/fs-read.js
vendored
@ -5,10 +5,11 @@ const common = require('../../common');
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const { pathToFileURL } = require('url');
|
||||||
|
|
||||||
const blockedFile = process.env.BLOCKEDFILE;
|
const blockedFile = process.env.BLOCKEDFILE;
|
||||||
const bufferBlockedFile = Buffer.from(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 blockedFolder = process.env.BLOCKEDFOLDER;
|
||||||
const allowedFolder = process.env.ALLOWEDFOLDER;
|
const allowedFolder = process.env.ALLOWEDFOLDER;
|
||||||
const regularFile = __filename;
|
const regularFile = __filename;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const dc = require('diagnostics_channel');
|
const dc = require('diagnostics_channel');
|
||||||
|
const { pathToFileURL } = require('url');
|
||||||
|
|
||||||
const trace = dc.tracingChannel('module.import');
|
const trace = dc.tracingChannel('module.import');
|
||||||
const events = [];
|
const events = [];
|
||||||
@ -30,10 +31,7 @@ trace.subscribe({
|
|||||||
import('does-not-exist').then(
|
import('does-not-exist').then(
|
||||||
common.mustNotCall(),
|
common.mustNotCall(),
|
||||||
common.mustCall((error) => {
|
common.mustCall((error) => {
|
||||||
let expectedParentURL = module.filename.replaceAll('\\', '/');
|
const expectedParentURL = pathToFileURL(module.filename).href;
|
||||||
expectedParentURL = common.isWindows ?
|
|
||||||
`file:///${expectedParentURL}` :
|
|
||||||
`file://${expectedParentURL}`;
|
|
||||||
// Verify order and contents of each event
|
// Verify order and contents of each event
|
||||||
assert.deepStrictEqual(events, [
|
assert.deepStrictEqual(events, [
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const dc = require('diagnostics_channel');
|
const dc = require('diagnostics_channel');
|
||||||
|
const { pathToFileURL } = require('url');
|
||||||
|
|
||||||
const trace = dc.tracingChannel('module.import');
|
const trace = dc.tracingChannel('module.import');
|
||||||
const events = [];
|
const events = [];
|
||||||
@ -29,10 +30,7 @@ trace.subscribe({
|
|||||||
|
|
||||||
import('http').then(
|
import('http').then(
|
||||||
common.mustCall((result) => {
|
common.mustCall((result) => {
|
||||||
let expectedParentURL = module.filename.replaceAll('\\', '/');
|
const expectedParentURL = pathToFileURL(module.filename).href;
|
||||||
expectedParentURL = common.isWindows ?
|
|
||||||
`file:///${expectedParentURL}` :
|
|
||||||
`file://${expectedParentURL}`;
|
|
||||||
// Verify order and contents of each event
|
// Verify order and contents of each event
|
||||||
assert.deepStrictEqual(events, [
|
assert.deepStrictEqual(events, [
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user