From 6f7379a048aaedc1f02a49193b364084f3725124 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 21 Oct 2024 02:27:11 +0200 Subject: [PATCH] test: fix invalid `file:` URL in `test-fs-path-dir` PR-URL: https://github.com/nodejs/node/pull/55454 Reviewed-By: LiviaMedeiros Reviewed-By: Jake Yuesong Li Reviewed-By: Luigi Pinca --- test/sequential/test-fs-path-dir.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/sequential/test-fs-path-dir.js b/test/sequential/test-fs-path-dir.js index fd44c19ff333e4..0926a207574b51 100644 --- a/test/sequential/test-fs-path-dir.js +++ b/test/sequential/test-fs-path-dir.js @@ -5,7 +5,7 @@ const tmpdir = require('../common/tmpdir'); const assert = require('assert'); const path = require('path'); const fs = require('fs'); -const URL = require('url').URL; +const { pathToFileURL } = require('url'); tmpdir.refresh(); @@ -15,7 +15,7 @@ const nextFile = () => path.join(tmpdir.path, `file${fileCounter++}`); const generateStringPath = (file, suffix = '') => file + suffix; const generateURLPath = (file, suffix = '') => - new URL('file://' + path.resolve(file) + suffix); + pathToFileURL(file + suffix); const generateUint8ArrayPath = (file, suffix = '') => new Uint8Array(Buffer.from(file + suffix));