diff --git a/graal-nodejs/test/parallel/test-fs-whatwg-url.js b/graal-nodejs/test/parallel/test-fs-whatwg-url.js index 829cfa92faf..5e9ea98a582 100644 --- a/graal-nodejs/test/parallel/test-fs-whatwg-url.js +++ b/graal-nodejs/test/parallel/test-fs-whatwg-url.js @@ -3,20 +3,10 @@ const common = require('../common'); const fixtures = require('../common/fixtures'); const assert = require('assert'); -const path = require('path'); const fs = require('fs'); const os = require('os'); -function pathToFileURL(p) { - if (!path.isAbsolute(p)) - throw new Error('Path must be absolute'); - if (common.isWindows && p.startsWith('\\\\')) - p = p.slice(2); - return new URL(`file://${p}`); -} - -const p = path.resolve(fixtures.fixturesDir, 'a.js'); -const url = pathToFileURL(p); +const url = fixtures.fileURL('a.js'); assert(url instanceof URL); diff --git a/graal-nodejs/test/parallel/test-module-create-require.js b/graal-nodejs/test/parallel/test-module-create-require.js index e0e34e9f127..30ebf966523 100644 --- a/graal-nodejs/test/parallel/test-module-create-require.js +++ b/graal-nodejs/test/parallel/test-module-create-require.js @@ -1,13 +1,12 @@ 'use strict'; require('../common'); +const fixtures = require('../common/fixtures'); const assert = require('assert'); -const path = require('path'); const { createRequire } = require('module'); -const p = path.resolve(__dirname, '..', 'fixtures', 'fake.js'); -const u = new URL(`file://${p}`); +const u = fixtures.fileURL('fake.js'); const reqToo = createRequire(u); assert.deepStrictEqual(reqToo('./experimental'), { ofLife: 42 });