| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,13 +2,11 @@ | |||
| 2 | 2 | // general startup, does not test lazy operations | |
| 3 | 3 | 'use strict'; | |
| 4 | 4 | const fs = require('node:fs'); | |
| 5 | - const path = require('node:path'); | ||
| 6 | 5 | const common = require('../common.js'); | |
| 7 | 6 | ||
| 8 | 7 | const tmpdir = require('../../test/common/tmpdir.js'); | |
| 9 | - const { pathToFileURL } = require('node:url'); | ||
| 10 | 8 | ||
| 11 | - const benchmarkDirectory = pathToFileURL(path.resolve(tmpdir.path, 'benchmark-import')); | ||
| 9 | + const benchmarkDirectory = tmpdir.fileURL('benchmark-import'); | ||
| 12 | 10 | ||
| 13 | 11 | const configs = { | |
| 14 | 12 | n: [1e3], | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,12 +4,9 @@ const tmpdir = require('../common/tmpdir'); | |||
| 4 | 4 | ||
| 5 | 5 | const assert = require('node:assert'); | |
| 6 | 6 | const fs = require('node:fs/promises'); | |
| 7 | - const { pathToFileURL } = require('node:url'); | ||
| 8 | 7 | ||
| 9 | 8 | tmpdir.refresh(); | |
| 10 | - const tmpDir = pathToFileURL(tmpdir.path); | ||
| 11 | - | ||
| 12 | - const target = new URL(`./${Math.random()}.mjs`, tmpDir); | ||
| 9 | + const target = tmpdir.fileURL(`${Math.random()}.mjs`); | ||
| 13 | 10 | ||
| 14 | 11 | (async () => { | |
| 15 | 12 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,12 +4,9 @@ import tmpdir from '../common/tmpdir.js'; | |||
| 4 | 4 | import assert from 'node:assert'; | |
| 5 | 5 | import fs from 'node:fs/promises'; | |
| 6 | 6 | import { execPath } from 'node:process'; | |
| 7 | - import { pathToFileURL } from 'node:url'; | ||
| 8 | 7 | ||
| 9 | 8 | tmpdir.refresh(); | |
| 10 | - const tmpDir = pathToFileURL(tmpdir.path); | ||
| 11 | - | ||
| 12 | - const target = new URL(`./${Math.random()}.mjs`, tmpDir); | ||
| 9 | + const target = tmpdir.fileURL(`${Math.random()}.mjs`); | ||
| 13 | 10 | ||
| 14 | 11 | await assert.rejects(import(target), { code: 'ERR_MODULE_NOT_FOUND' }); | |
| 15 | 12 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,11 +24,6 @@ const policyFilepath = path.join(tmpdir.path, 'policy'); | |||
| 24 | 24 | const depFilepath = require.resolve(`./build/${common.buildType}/binding.node`); | |
| 25 | 25 | const depURL = pathToFileURL(depFilepath); | |
| 26 | 26 | ||
| 27 | - const tmpdirURL = pathToFileURL(tmpdir.path); | ||
| 28 | - if (!tmpdirURL.pathname.endsWith('/')) { | ||
| 29 | - tmpdirURL.pathname += '/'; | ||
| 30 | - } | ||
| 31 | - | ||
| 32 | 27 | const depBody = fs.readFileSync(depURL); | |
| 33 | 28 | function writePolicy(...resources) { | |
| 34 | 29 | const manifest = { resources: {} }; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments