diff --git a/test/parallel/test-common.js b/test/parallel/test-common.js index 54e851fce1abdb..534c3b5f811deb 100644 --- a/test/parallel/test-common.js +++ b/test/parallel/test-common.js @@ -27,7 +27,6 @@ const tmpdir = require('../common/tmpdir'); const assert = require('assert'); const { execFile } = require('child_process'); const { writeFileSync, existsSync } = require('fs'); -const { join } = require('path'); // Test for leaked global detection { @@ -134,7 +133,7 @@ const HIJACK_TEST_ARRAY = [ 'foo\n', 'bar\n', 'baz\n' ]; { tmpdir.refresh(); assert.match(tmpdir.path, /\.tmp\.\d+/); - const sentinelPath = join(tmpdir.path, 'gaga'); + const sentinelPath = tmpdir.resolve('gaga'); writeFileSync(sentinelPath, 'googoo'); tmpdir.refresh(); assert.strictEqual(existsSync(tmpdir.path), true); diff --git a/test/parallel/test-debugger-heap-profiler.js b/test/parallel/test-debugger-heap-profiler.js index 1237c33f7f4567..56f0d8b5184f18 100644 --- a/test/parallel/test-debugger-heap-profiler.js +++ b/test/parallel/test-debugger-heap-profiler.js @@ -6,13 +6,12 @@ common.skipIfInspectorDisabled(); const fixtures = require('../common/fixtures'); const startCLI = require('../common/debugger'); const tmpdir = require('../common/tmpdir'); -const path = require('path'); tmpdir.refresh(); const { readFileSync } = require('fs'); -const filename = path.join(tmpdir.path, 'node.heapsnapshot'); +const filename = tmpdir.resolve('node.heapsnapshot'); // Heap profiler take snapshot. { diff --git a/test/parallel/test-file-write-stream.js b/test/parallel/test-file-write-stream.js index 09f2063e5623f3..573cd409db3ecb 100644 --- a/test/parallel/test-file-write-stream.js +++ b/test/parallel/test-file-write-stream.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -const path = require('path'); const fs = require('fs'); const tmpdir = require('../common/tmpdir'); -const fn = path.join(tmpdir.path, 'write.txt'); +const fn = tmpdir.resolve('write.txt'); tmpdir.refresh(); const file = fs.createWriteStream(fn, { highWaterMark: 10 diff --git a/test/parallel/test-file-write-stream2.js b/test/parallel/test-file-write-stream2.js index eac81b805b108a..ca52135ecf6cf1 100644 --- a/test/parallel/test-file-write-stream2.js +++ b/test/parallel/test-file-write-stream2.js @@ -23,13 +23,12 @@ require('../common'); const assert = require('assert'); -const path = require('path'); const fs = require('fs'); const tmpdir = require('../common/tmpdir'); -const filepath = path.join(tmpdir.path, 'write.txt'); +const filepath = tmpdir.resolve('write.txt'); const EXPECTED = '012345678910'; diff --git a/test/parallel/test-file-write-stream3.js b/test/parallel/test-file-write-stream3.js index b68fdbf3a1fbfc..94ea9bcbc910db 100644 --- a/test/parallel/test-file-write-stream3.js +++ b/test/parallel/test-file-write-stream3.js @@ -22,13 +22,12 @@ 'use strict'; const common = require('../common'); const assert = require('assert'); -const path = require('path'); const fs = require('fs'); const tmpdir = require('../common/tmpdir'); -const filepath = path.join(tmpdir.path, 'write_pos.txt'); +const filepath = tmpdir.resolve('write_pos.txt'); const cb_expected = 'write open close write open close write open close '; diff --git a/test/parallel/test-file-write-stream4.js b/test/parallel/test-file-write-stream4.js index 2a81efcb66756f..6b3862fa714d7c 100644 --- a/test/parallel/test-file-write-stream4.js +++ b/test/parallel/test-file-write-stream4.js @@ -4,13 +4,12 @@ // Refs: https://github.com/nodejs/node/issues/31366 const common = require('../common'); -const path = require('path'); const fs = require('fs'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const filepath = path.join(tmpdir.path, 'write_pos.txt'); +const filepath = tmpdir.resolve('write_pos.txt'); const fileReadStream = fs.createReadStream(process.execPath); const fileWriteStream = fs.createWriteStream(filepath, { diff --git a/test/parallel/test-heap-prof-dir-absolute.js b/test/parallel/test-heap-prof-dir-absolute.js index 5fa22470545624..a31a1c484ff0e1 100644 --- a/test/parallel/test-heap-prof-dir-absolute.js +++ b/test/parallel/test-heap-prof-dir-absolute.js @@ -9,7 +9,6 @@ common.skipIfInspectorDisabled(); const assert = require('assert'); const fs = require('fs'); -const path = require('path'); const { spawnSync } = require('child_process'); const tmpdir = require('../common/tmpdir'); @@ -24,7 +23,7 @@ const { // Tests absolute --heap-prof-dir { tmpdir.refresh(); - const dir = path.join(tmpdir.path, 'prof'); + const dir = tmpdir.resolve('prof'); const output = spawnSync(process.execPath, [ '--heap-prof', '--heap-prof-dir', diff --git a/test/parallel/test-heap-prof-dir-name.js b/test/parallel/test-heap-prof-dir-name.js index ebc9374859663f..34066528134510 100644 --- a/test/parallel/test-heap-prof-dir-name.js +++ b/test/parallel/test-heap-prof-dir-name.js @@ -23,7 +23,7 @@ const { { tmpdir.refresh(); - const dir = path.join(tmpdir.path, 'prof'); + const dir = tmpdir.resolve('prof'); const file = path.join(dir, 'test.heapprofile'); const output = spawnSync(process.execPath, [ '--heap-prof', diff --git a/test/parallel/test-heap-prof-dir-relative.js b/test/parallel/test-heap-prof-dir-relative.js index 8b71856cde99bc..95d4284ac5733e 100644 --- a/test/parallel/test-heap-prof-dir-relative.js +++ b/test/parallel/test-heap-prof-dir-relative.js @@ -9,7 +9,6 @@ common.skipIfInspectorDisabled(); const assert = require('assert'); const fs = require('fs'); -const path = require('path'); const { spawnSync } = require('child_process'); const tmpdir = require('../common/tmpdir'); @@ -38,7 +37,7 @@ const { console.log(output.stderr.toString()); } assert.strictEqual(output.status, 0); - const dir = path.join(tmpdir.path, 'prof'); + const dir = tmpdir.resolve('prof'); assert(fs.existsSync(dir)); const profiles = getHeapProfiles(dir); assert.strictEqual(profiles.length, 1); diff --git a/test/parallel/test-heap-prof-interval.js b/test/parallel/test-heap-prof-interval.js index 18841016a71371..71cee80dd98165 100644 --- a/test/parallel/test-heap-prof-interval.js +++ b/test/parallel/test-heap-prof-interval.js @@ -9,7 +9,6 @@ common.skipIfInspectorDisabled(); const assert = require('assert'); const fs = require('fs'); -const path = require('path'); const { spawnSync } = require('child_process'); const tmpdir = require('../common/tmpdir'); @@ -38,7 +37,7 @@ const { console.log(output.stderr.toString()); } assert.strictEqual(output.status, 0); - const dir = path.join(tmpdir.path, 'prof'); + const dir = tmpdir.resolve('prof'); assert(fs.existsSync(dir)); const profiles = getHeapProfiles(dir); assert.strictEqual(profiles.length, 2); diff --git a/test/parallel/test-heap-prof-name.js b/test/parallel/test-heap-prof-name.js index a2bf6aae396203..2af78f1f1ff2f8 100644 --- a/test/parallel/test-heap-prof-name.js +++ b/test/parallel/test-heap-prof-name.js @@ -8,7 +8,6 @@ const fixtures = require('../common/fixtures'); common.skipIfInspectorDisabled(); const assert = require('assert'); -const path = require('path'); const { spawnSync } = require('child_process'); const tmpdir = require('../common/tmpdir'); @@ -22,7 +21,7 @@ const { { tmpdir.refresh(); - const file = path.join(tmpdir.path, 'test.heapprofile'); + const file = tmpdir.resolve('test.heapprofile'); const output = spawnSync(process.execPath, [ '--heap-prof', '--heap-prof-name', diff --git a/test/parallel/test-internal-fs-syncwritestream.js b/test/parallel/test-internal-fs-syncwritestream.js index e0d0289cbcef85..93fbfbc9f4cd5e 100644 --- a/test/parallel/test-internal-fs-syncwritestream.js +++ b/test/parallel/test-internal-fs-syncwritestream.js @@ -4,13 +4,12 @@ const common = require('../common'); const assert = require('assert'); const fs = require('fs'); -const path = require('path'); const SyncWriteStream = require('internal/fs/sync_write_stream'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const filename = path.join(tmpdir.path, 'sync-write-stream.txt'); +const filename = tmpdir.resolve('sync-write-stream.txt'); // Verify constructing the instance with default options. { diff --git a/test/parallel/test-macos-app-sandbox.js b/test/parallel/test-macos-app-sandbox.js index 7de50d4b4a2507..91485b75983f84 100644 --- a/test/parallel/test-macos-app-sandbox.js +++ b/test/parallel/test-macos-app-sandbox.js @@ -17,7 +17,7 @@ const nodeBinary = process.execPath; tmpdir.refresh(); -const appBundlePath = path.join(tmpdir.path, 'node_sandboxed.app'); +const appBundlePath = tmpdir.resolve('node_sandboxed.app'); const appBundleContentPath = path.join(appBundlePath, 'Contents'); const appExecutablePath = path.join( appBundleContentPath, 'MacOS', 'node'); diff --git a/test/parallel/test-module-cache.js b/test/parallel/test-module-cache.js index 0f63829750beb1..87913c72ccad70 100644 --- a/test/parallel/test-module-cache.js +++ b/test/parallel/test-module-cache.js @@ -2,11 +2,10 @@ require('../common'); const assert = require('assert'); const fs = require('fs'); -const path = require('path'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const filePath = path.join(tmpdir.path, 'test-module-cache.json'); +const filePath = tmpdir.resolve('test-module-cache.json'); assert.throws( () => require(filePath), { code: 'MODULE_NOT_FOUND' } diff --git a/test/parallel/test-module-loading-globalpaths.js b/test/parallel/test-module-loading-globalpaths.js index 5d6a104f29c9d7..a7b846019957d6 100644 --- a/test/parallel/test-module-loading-globalpaths.js +++ b/test/parallel/test-module-loading-globalpaths.js @@ -18,7 +18,7 @@ if (process.argv[2] === 'child') { tmpdir.refresh(); // Copy node binary into a test $PREFIX directory. - const prefixPath = path.join(tmpdir.path, 'install'); + const prefixPath = tmpdir.resolve('install'); fs.mkdirSync(prefixPath); let testExecPath; if (common.isWindows) { @@ -46,7 +46,7 @@ if (process.argv[2] === 'child') { delete env.NODE_PATH; // Test empty global path. - const noPkgHomeDir = path.join(tmpdir.path, 'home-no-pkg'); + const noPkgHomeDir = tmpdir.resolve('home-no-pkg'); fs.mkdirSync(noPkgHomeDir); env.HOME = env.USERPROFILE = noPkgHomeDir; assert.throws( diff --git a/test/parallel/test-module-multi-extensions.js b/test/parallel/test-module-multi-extensions.js index 01789a6c496fd4..205a030c57e8aa 100644 --- a/test/parallel/test-module-multi-extensions.js +++ b/test/parallel/test-module-multi-extensions.js @@ -5,12 +5,11 @@ const common = require('../common'); const assert = require('assert'); const fs = require('fs'); -const path = require('path'); const Module = require('module'); const tmpdir = require('../common/tmpdir'); -const file = path.join(tmpdir.path, 'test-extensions.foo.bar'); -const dotfile = path.join(tmpdir.path, '.bar'); -const dotfileWithExtension = path.join(tmpdir.path, '.foo.bar'); +const file = tmpdir.resolve('test-extensions.foo.bar'); +const dotfile = tmpdir.resolve('.bar'); +const dotfileWithExtension = tmpdir.resolve('.foo.bar'); tmpdir.refresh(); fs.writeFileSync(file, 'console.log(__filename);', 'utf8'); @@ -20,7 +19,7 @@ fs.writeFileSync(dotfileWithExtension, 'console.log(__filename);', 'utf8'); { require.extensions['.bar'] = common.mustNotCall(); require.extensions['.foo.bar'] = common.mustCall(); - const modulePath = path.join(tmpdir.path, 'test-extensions'); + const modulePath = tmpdir.resolve('test-extensions'); require(modulePath); require(file); delete require.cache[file]; @@ -31,7 +30,7 @@ fs.writeFileSync(dotfileWithExtension, 'console.log(__filename);', 'utf8'); { require.extensions['.foo.bar'] = common.mustCall(); - const modulePath = path.join(tmpdir.path, 'test-extensions'); + const modulePath = tmpdir.resolve('test-extensions'); require(modulePath); assert.throws( () => require(`${modulePath}.foo`), @@ -44,7 +43,7 @@ fs.writeFileSync(dotfileWithExtension, 'console.log(__filename);', 'utf8'); } { - const modulePath = path.join(tmpdir.path, 'test-extensions'); + const modulePath = tmpdir.resolve('test-extensions'); assert.throws( () => require(modulePath), (err) => err.message.startsWith(`Cannot find module '${modulePath}'`) @@ -56,7 +55,7 @@ fs.writeFileSync(dotfileWithExtension, 'console.log(__filename);', 'utf8'); { require.extensions['.bar'] = common.mustNotCall(); require.extensions['.foo.bar'] = common.mustCall(); - const modulePath = path.join(tmpdir.path, 'test-extensions.foo'); + const modulePath = tmpdir.resolve('test-extensions.foo'); require(modulePath); delete require.cache[file]; delete require.extensions['.bar']; @@ -66,7 +65,7 @@ fs.writeFileSync(dotfileWithExtension, 'console.log(__filename);', 'utf8'); { require.extensions['.foo.bar'] = common.mustNotCall(); - const modulePath = path.join(tmpdir.path, 'test-extensions.foo'); + const modulePath = tmpdir.resolve('test-extensions.foo'); assert.throws( () => require(modulePath), (err) => err.message.startsWith(`Cannot find module '${modulePath}'`) diff --git a/test/parallel/test-module-readonly.js b/test/parallel/test-module-readonly.js index 8f14d9ee18c34a..ad9fbf7d21bbcb 100644 --- a/test/parallel/test-module-readonly.js +++ b/test/parallel/test-module-readonly.js @@ -16,7 +16,7 @@ const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); // Create readOnlyMod.js and set to read only -const readOnlyMod = path.join(tmpdir.path, 'readOnlyMod'); +const readOnlyMod = tmpdir.resolve('readOnlyMod'); const readOnlyModRelative = path.relative(__dirname, readOnlyMod); const readOnlyModFullPath = `${readOnlyMod}.js`; diff --git a/test/parallel/test-module-stat.js b/test/parallel/test-module-stat.js index eaaeb898afd603..0ab63f8edf9573 100644 --- a/test/parallel/test-module-stat.js +++ b/test/parallel/test-module-stat.js @@ -7,11 +7,10 @@ const Module = require('module'); const fs = require('fs'); const tmpdir = require('../common/tmpdir'); const { ok, strictEqual } = require('assert'); -const { join } = require('path'); -const directory = join(tmpdir.path, 'directory'); -const doesNotExist = join(tmpdir.path, 'does-not-exist'); -const file = join(tmpdir.path, 'file.js'); +const directory = tmpdir.resolve('directory'); +const doesNotExist = tmpdir.resolve('does-not-exist'); +const file = tmpdir.resolve('file.js'); tmpdir.refresh(); fs.writeFileSync(file, "module.exports = { a: 'b' }"); diff --git a/test/parallel/test-npm-install.js b/test/parallel/test-npm-install.js index d3ba8ab8b55561..5adca8001e3133 100644 --- a/test/parallel/test-npm-install.js +++ b/test/parallel/test-npm-install.js @@ -11,11 +11,11 @@ const fixtures = require('../common/fixtures'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const npmSandbox = path.join(tmpdir.path, 'npm-sandbox'); +const npmSandbox = tmpdir.resolve('npm-sandbox'); fs.mkdirSync(npmSandbox); -const homeDir = path.join(tmpdir.path, 'home'); +const homeDir = tmpdir.resolve('home'); fs.mkdirSync(homeDir); -const installDir = path.join(tmpdir.path, 'install-dir'); +const installDir = tmpdir.resolve('install-dir'); fs.mkdirSync(installDir); const npmPath = path.join( diff --git a/test/parallel/test-permission-fs-symlink-target-write.js b/test/parallel/test-permission-fs-symlink-target-write.js index f6a99fe06c9d1f..55251cb163b126 100644 --- a/test/parallel/test-permission-fs-symlink-target-write.js +++ b/test/parallel/test-permission-fs-symlink-target-write.js @@ -19,9 +19,9 @@ const { spawnSync } = require('child_process'); tmpdir.refresh(); } -const readOnlyFolder = path.join(tmpdir.path, 'read-only'); -const readWriteFolder = path.join(tmpdir.path, 'read-write'); -const writeOnlyFolder = path.join(tmpdir.path, 'write-only'); +const readOnlyFolder = tmpdir.resolve('read-only'); +const readWriteFolder = tmpdir.resolve('read-write'); +const writeOnlyFolder = tmpdir.resolve('write-only'); const file = fixtures.path('permission', 'fs-symlink-target-write.js'); const commonPathWildcard = path.join(__filename, '../../common*'); diff --git a/test/parallel/test-permission-fs-symlink.js b/test/parallel/test-permission-fs-symlink.js index 96d4fdad4d2d4b..808965001accd5 100644 --- a/test/parallel/test-permission-fs-symlink.js +++ b/test/parallel/test-permission-fs-symlink.js @@ -19,8 +19,8 @@ const tmpdir = require('../common/tmpdir'); const file = fixtures.path('permission', 'fs-symlink.js'); const commonPathWildcard = path.join(__filename, '../../common*'); const blockedFile = fixtures.path('permission', 'deny', 'protected-file.md'); -const blockedFolder = path.join(tmpdir.path, 'subdirectory'); -const symlinkFromBlockedFile = path.join(tmpdir.path, 'example-symlink.md'); +const blockedFolder = tmpdir.resolve('subdirectory'); +const symlinkFromBlockedFile = tmpdir.resolve('example-symlink.md'); { tmpdir.refresh(); diff --git a/test/parallel/test-permission-fs-traversal-path.js b/test/parallel/test-permission-fs-traversal-path.js index 2b294a4574e2f3..b84bed65db3b0a 100644 --- a/test/parallel/test-permission-fs-traversal-path.js +++ b/test/parallel/test-permission-fs-traversal-path.js @@ -18,7 +18,7 @@ const tmpdir = require('../common/tmpdir'); const file = fixtures.path('permission', 'fs-traversal.js'); const blockedFolder = tmpdir.path; -const allowedFolder = path.join(tmpdir.path, 'subdirectory/'); +const allowedFolder = tmpdir.resolve('subdirectory/'); const commonPathWildcard = path.join(__filename, '../../common*'); { diff --git a/test/parallel/test-pipe-file-to-http.js b/test/parallel/test-pipe-file-to-http.js index 99f18e74d318f8..6c1244427d9fa7 100644 --- a/test/parallel/test-pipe-file-to-http.js +++ b/test/parallel/test-pipe-file-to-http.js @@ -24,12 +24,11 @@ const common = require('../common'); const assert = require('assert'); const fs = require('fs'); const http = require('http'); -const path = require('path'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const filename = path.join(tmpdir.path, 'big'); +const filename = tmpdir.resolve('big'); let count = 0; const server = http.createServer((req, res) => { diff --git a/test/parallel/test-policy-parse-integrity.js b/test/parallel/test-policy-parse-integrity.js index 7c48eeb01426c8..3295bed28fb5a8 100644 --- a/test/parallel/test-policy-parse-integrity.js +++ b/test/parallel/test-policy-parse-integrity.js @@ -20,7 +20,7 @@ function hash(algo, body) { return h.digest('base64'); } -const tmpdirPath = path.join(tmpdir.path, 'test-policy-parse-integrity'); +const tmpdirPath = tmpdir.resolve('test-policy-parse-integrity'); fs.rmSync(tmpdirPath, { maxRetries: 3, recursive: true, force: true }); fs.mkdirSync(tmpdirPath, { recursive: true }); diff --git a/test/parallel/test-preload-print-process-argv.js b/test/parallel/test-preload-print-process-argv.js index 8baec6972ccd61..9d2774f8a4b3e6 100644 --- a/test/parallel/test-preload-print-process-argv.js +++ b/test/parallel/test-preload-print-process-argv.js @@ -7,19 +7,18 @@ require('../common'); const tmpdir = require('../common/tmpdir'); const assert = require('assert'); -const { join } = require('path'); const { spawnSync } = require('child_process'); const fs = require('fs'); tmpdir.refresh(); fs.writeFileSync( - join(tmpdir.path, 'preload.js'), + tmpdir.resolve('preload.js'), 'console.log(JSON.stringify(process.argv));', 'utf-8'); fs.writeFileSync( - join(tmpdir.path, 'main.js'), + tmpdir.resolve('main.js'), 'console.log(JSON.stringify(process.argv));', 'utf-8'); diff --git a/test/parallel/test-process-chdir.js b/test/parallel/test-process-chdir.js index 8340f772044c4a..ee59df853b24ce 100644 --- a/test/parallel/test-process-chdir.js +++ b/test/parallel/test-process-chdir.js @@ -23,7 +23,7 @@ if (process.versions.icu) { // ICU is unavailable, use characters that can't be decomposed dirName = 'weird \ud83d\udc04 characters \ud83d\udc05'; } -const dir = path.resolve(tmpdir.path, dirName); +const dir = tmpdir.resolve(dirName); // Make sure that the tmp directory is clean tmpdir.refresh(); diff --git a/test/parallel/test-process-execpath.js b/test/parallel/test-process-execpath.js index 68aef90b303449..0fce35e2645e5b 100644 --- a/test/parallel/test-process-execpath.js +++ b/test/parallel/test-process-execpath.js @@ -5,7 +5,6 @@ if (common.isWindows) const assert = require('assert'); const child_process = require('child_process'); -const path = require('path'); const fs = require('fs'); assert.strictEqual(process.execPath, fs.realpathSync(process.execPath)); @@ -17,7 +16,7 @@ if (process.argv[2] === 'child') { const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); - const symlinkedNode = path.join(tmpdir.path, 'symlinked-node'); + const symlinkedNode = tmpdir.resolve('symlinked-node'); fs.symlinkSync(process.execPath, symlinkedNode); const proc = child_process.spawnSync(symlinkedNode, [__filename, 'child']); diff --git a/test/parallel/test-process-redirect-warnings-env.js b/test/parallel/test-process-redirect-warnings-env.js index 50abdbf64b70dd..1e575cfa67c350 100644 --- a/test/parallel/test-process-redirect-warnings-env.js +++ b/test/parallel/test-process-redirect-warnings-env.js @@ -9,14 +9,13 @@ const common = require('../common'); const fixtures = require('../common/fixtures'); const fs = require('fs'); const fork = require('child_process').fork; -const path = require('path'); const assert = require('assert'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); const warnmod = require.resolve(fixtures.path('warnings.js')); -const warnpath = path.join(tmpdir.path, 'warnings.txt'); +const warnpath = tmpdir.resolve('warnings.txt'); fork(warnmod, { env: { ...process.env, NODE_REDIRECT_WARNINGS: warnpath } }) .on('exit', common.mustCall(() => { diff --git a/test/parallel/test-process-redirect-warnings.js b/test/parallel/test-process-redirect-warnings.js index 9eb7bbc639fc18..3d71fb2abce599 100644 --- a/test/parallel/test-process-redirect-warnings.js +++ b/test/parallel/test-process-redirect-warnings.js @@ -9,14 +9,13 @@ const common = require('../common'); const fixtures = require('../common/fixtures'); const fs = require('fs'); const fork = require('child_process').fork; -const path = require('path'); const assert = require('assert'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); const warnmod = fixtures.path('warnings.js'); -const warnpath = path.join(tmpdir.path, 'warnings.txt'); +const warnpath = tmpdir.resolve('warnings.txt'); fork(warnmod, { execArgv: [`--redirect-warnings=${warnpath}`] }) .on('exit', common.mustCall(() => { diff --git a/test/parallel/test-require-enoent-dir.js b/test/parallel/test-require-enoent-dir.js index 519c3e4ea720a5..2e600425854304 100644 --- a/test/parallel/test-require-enoent-dir.js +++ b/test/parallel/test-require-enoent-dir.js @@ -8,10 +8,10 @@ const path = require('path'); tmpdir.refresh(); -const fooPath = path.join(tmpdir.path, 'foo.cjs'); +const fooPath = tmpdir.resolve('foo.cjs'); fs.writeFileSync(fooPath, ''); -const dirPath = path.join(tmpdir.path, 'delete_me'); +const dirPath = tmpdir.resolve('delete_me'); fs.mkdirSync(dirPath, { recursive: true }); diff --git a/test/parallel/test-require-long-path.js b/test/parallel/test-require-long-path.js index c39d8f2a41fe1c..abc75176bc5703 100644 --- a/test/parallel/test-require-long-path.js +++ b/test/parallel/test-require-long-path.js @@ -10,7 +10,7 @@ const tmpdir = require('../common/tmpdir'); // Make a path that is more than 260 chars long. const dirNameLen = Math.max(260 - tmpdir.path.length, 1); -const dirName = path.join(tmpdir.path, 'x'.repeat(dirNameLen)); +const dirName = tmpdir.resolve('x'.repeat(dirNameLen)); const fullDirPath = path.resolve(dirName); const indexFile = path.join(fullDirPath, 'index.js'); diff --git a/test/parallel/test-require-symlink.js b/test/parallel/test-require-symlink.js index 14eefcd60d32dc..0c4477023bc90b 100644 --- a/test/parallel/test-require-symlink.js +++ b/test/parallel/test-require-symlink.js @@ -20,7 +20,7 @@ const fixtures = require('../common/fixtures'); const tmpdir = require('../common/tmpdir'); const dirName = 'module-require-symlink'; const fixtureSource = fixtures.path(dirName); -const tmpDirTarget = path.join(tmpdir.path, dirName); +const tmpDirTarget = tmpdir.resolve(dirName); // Copy fixtureSource to linkTarget recursively. tmpdir.refresh(); diff --git a/test/parallel/test-require-unicode.js b/test/parallel/test-require-unicode.js index 530ff3bb56c3d0..362ec6487a957b 100644 --- a/test/parallel/test-require-unicode.js +++ b/test/parallel/test-require-unicode.js @@ -8,7 +8,7 @@ const path = require('path'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const dirname = path.join(tmpdir.path, '\u4e2d\u6587\u76ee\u5f55'); +const dirname = tmpdir.resolve('\u4e2d\u6587\u76ee\u5f55'); fs.mkdirSync(dirname); fs.writeFileSync(path.join(dirname, 'file.js'), 'module.exports = 42;'); fs.writeFileSync(path.join(dirname, 'package.json'), diff --git a/test/parallel/test-runner-concurrency.js b/test/parallel/test-runner-concurrency.js index 5a9ac8ec44beef..2cb01bdc268f19 100644 --- a/test/parallel/test-runner-concurrency.js +++ b/test/parallel/test-runner-concurrency.js @@ -4,7 +4,6 @@ const tmpdir = require('../common/tmpdir'); const fixtures = require('../common/fixtures'); const { describe, it, test } = require('node:test'); const assert = require('node:assert'); -const path = require('node:path'); const fs = require('node:fs/promises'); const os = require('node:os'); const timers = require('node:timers/promises'); @@ -88,7 +87,7 @@ describe('concurrency: true implies Infinity', { concurrency: true }, () => { } test('--test multiple files', { skip: os.availableParallelism() < 3 }, async () => { - await fs.writeFile(path.resolve(tmpdir.path, 'test-runner-concurrency'), ''); + await fs.writeFile(tmpdir.resolve('test-runner-concurrency'), ''); const { code, stderr } = await common.spawnPromisified(process.execPath, [ '--test', fixtures.path('test-runner', 'concurrency', 'a.mjs'), diff --git a/test/parallel/test-runner-import-no-scheme.js b/test/parallel/test-runner-import-no-scheme.js index 85953af77bf9a5..fe827bd2207e1a 100644 --- a/test/parallel/test-runner-import-no-scheme.js +++ b/test/parallel/test-runner-import-no-scheme.js @@ -29,8 +29,8 @@ for (const name in ['test', 'test/reporters']) { // Verify that files in node_modules can be resolved. tmpdir.refresh(); -const packageRoot = path.join(tmpdir.path, 'node_modules', 'test'); -const reportersDir = path.join(tmpdir.path, 'node_modules', 'test', 'reporters'); +const packageRoot = tmpdir.resolve('node_modules', 'test'); +const reportersDir = tmpdir.resolve('node_modules', 'test', 'reporters'); const indexFile = path.join(packageRoot, 'index.js'); const reportersIndexFile = path.join(reportersDir, 'index.js'); @@ -59,7 +59,7 @@ test(['--input-type=module', '-e', 'console.log((await import("test")).default)' test(['--input-type=module', '-e', 'console.log((await import("test/reporters")).default)'], true); { - const dummyFile = path.join(tmpdir.path, 'file.js'); + const dummyFile = tmpdir.resolve('file.js'); const require = createRequire(dummyFile); assert.strictEqual(require.resolve('test'), indexFile); assert.strictEqual(require.resolve('test/reporters'), reportersIndexFile); diff --git a/test/parallel/test-runner-inspect.mjs b/test/parallel/test-runner-inspect.mjs index fb8e0ef9031571..4cfc6bea54b964 100644 --- a/test/parallel/test-runner-inspect.mjs +++ b/test/parallel/test-runner-inspect.mjs @@ -61,7 +61,7 @@ tmpdir.refresh(); // Outputs coverage when event loop is drained, with no async logic. { - const coverageDirectory = path.join(tmpdir.path, 'coverage'); + const coverageDirectory = tmpdir.resolve('coverage'); async function getCoveredFiles() { const coverageFiles = await fs.readdir(coverageDirectory); const files = new Set(); diff --git a/test/parallel/test-runner-reporters.js b/test/parallel/test-runner-reporters.js index f25e1a18b9d78d..c7c883286c70c0 100644 --- a/test/parallel/test-runner-reporters.js +++ b/test/parallel/test-runner-reporters.js @@ -6,7 +6,6 @@ const tmpdir = require('../common/tmpdir'); const { describe, it } = require('node:test'); const { spawnSync } = require('node:child_process'); const assert = require('node:assert'); -const path = require('node:path'); const fs = require('node:fs'); const testFile = fixtures.path('test-runner/reporters.js'); @@ -56,7 +55,7 @@ describe('node:test reporters', { concurrency: true }, () => { }); it('should support a file as a destination', async () => { - const file = path.join(tmpdir.path, `${tmpFiles++}.out`); + const file = tmpdir.resolve(`${tmpFiles++}.out`); const child = spawnSync(process.execPath, ['--test', '--test-reporter', 'dot', '--test-reporter-destination', file, testFile]); assert.strictEqual(child.stderr.toString(), ''); @@ -72,8 +71,8 @@ describe('node:test reporters', { concurrency: true }, () => { }); it('should support multiple reporters', async () => { - const file = path.join(tmpdir.path, `${tmpFiles++}.out`); - const file2 = path.join(tmpdir.path, `${tmpFiles++}.out`); + const file = tmpdir.resolve(`${tmpFiles++}.out`); + const file2 = tmpdir.resolve(`${tmpFiles++}.out`); const child = spawnSync(process.execPath, ['--test', '--test-reporter', 'dot', '--test-reporter-destination', file, diff --git a/test/parallel/test-runner-watch-mode.mjs b/test/parallel/test-runner-watch-mode.mjs index 0a577140db3075..92a2b972cf6f0d 100644 --- a/test/parallel/test-runner-watch-mode.mjs +++ b/test/parallel/test-runner-watch-mode.mjs @@ -1,6 +1,5 @@ // Flags: --expose-internals import * as common from '../common/index.mjs'; -import path from 'node:path'; import { describe, it } from 'node:test'; import { spawn } from 'node:child_process'; import { writeFileSync } from 'node:fs'; @@ -26,7 +25,7 @@ import('data:text/javascript,'); test('test has ran');`, }; const fixturePaths = Object.keys(fixtureContent) - .reduce((acc, file) => ({ ...acc, [file]: path.join(tmpdir.path, file) }), {}); + .reduce((acc, file) => ({ ...acc, [file]: tmpdir.resolve(file) }), {}); Object.entries(fixtureContent) .forEach(([file, content]) => writeFileSync(fixturePaths[file], content)); diff --git a/test/parallel/test-single-executable-blob-config-errors.js b/test/parallel/test-single-executable-blob-config-errors.js index fd4a4133399ab6..364a533c0c90fb 100644 --- a/test/parallel/test-single-executable-blob-config-errors.js +++ b/test/parallel/test-single-executable-blob-config-errors.js @@ -7,7 +7,6 @@ const tmpdir = require('../common/tmpdir'); const { writeFileSync, mkdirSync } = require('fs'); const { spawnSync } = require('child_process'); const assert = require('assert'); -const { join } = require('path'); { tmpdir.refresh(); @@ -27,7 +26,7 @@ const { join } = require('path'); { tmpdir.refresh(); - const config = join(tmpdir.path, 'non-existent-absolute.json'); + const config = tmpdir.resolve('non-existent-absolute.json'); const child = spawnSync( process.execPath, ['--experimental-sea-config', config], { @@ -44,7 +43,7 @@ const { join } = require('path'); { tmpdir.refresh(); - const config = join(tmpdir.path, 'invalid.json'); + const config = tmpdir.resolve('invalid.json'); writeFileSync(config, '\n{\n"main"', 'utf8'); const child = spawnSync( process.execPath, @@ -63,7 +62,7 @@ const { join } = require('path'); { tmpdir.refresh(); - const config = join(tmpdir.path, 'empty.json'); + const config = tmpdir.resolve('empty.json'); writeFileSync(config, '{}', 'utf8'); const child = spawnSync( process.execPath, @@ -81,7 +80,7 @@ const { join } = require('path'); { tmpdir.refresh(); - const config = join(tmpdir.path, 'no-main.json'); + const config = tmpdir.resolve('no-main.json'); writeFileSync(config, '{"output": "test.blob"}', 'utf8'); const child = spawnSync( process.execPath, @@ -99,7 +98,7 @@ const { join } = require('path'); { tmpdir.refresh(); - const config = join(tmpdir.path, 'no-output.json'); + const config = tmpdir.resolve('no-output.json'); writeFileSync(config, '{"main": "bundle.js"}', 'utf8'); const child = spawnSync( process.execPath, @@ -117,7 +116,7 @@ const { join } = require('path'); { tmpdir.refresh(); - const config = join(tmpdir.path, 'invalid-disableExperimentalSEAWarning.json'); + const config = tmpdir.resolve('invalid-disableExperimentalSEAWarning.json'); writeFileSync(config, ` { "main": "bundle.js", @@ -141,7 +140,7 @@ const { join } = require('path'); { tmpdir.refresh(); - const config = join(tmpdir.path, 'nonexistent-main-relative.json'); + const config = tmpdir.resolve('nonexistent-main-relative.json'); writeFileSync(config, '{"main": "bundle.js", "output": "sea.blob"}', 'utf8'); const child = spawnSync( process.execPath, @@ -155,8 +154,8 @@ const { join } = require('path'); { tmpdir.refresh(); - const config = join(tmpdir.path, 'nonexistent-main-absolute.json'); - const main = join(tmpdir.path, 'bundle.js'); + const config = tmpdir.resolve('nonexistent-main-absolute.json'); + const main = tmpdir.resolve('bundle.js'); const configJson = JSON.stringify({ main, output: 'sea.blob' @@ -179,9 +178,9 @@ const { join } = require('path'); { tmpdir.refresh(); - const config = join(tmpdir.path, 'output-is-dir-absolute.json'); - const main = join(tmpdir.path, 'bundle.js'); - const output = join(tmpdir.path, 'output-dir'); + const config = tmpdir.resolve('output-is-dir-absolute.json'); + const main = tmpdir.resolve('bundle.js'); + const output = tmpdir.resolve('output-dir'); mkdirSync(output); writeFileSync(main, 'console.log("hello")', 'utf-8'); const configJson = JSON.stringify({ @@ -206,9 +205,9 @@ const { join } = require('path'); { tmpdir.refresh(); - const config = join(tmpdir.path, 'output-is-dir-relative.json'); - const main = join(tmpdir.path, 'bundle.js'); - const output = join(tmpdir.path, 'output-dir'); + const config = tmpdir.resolve('output-is-dir-relative.json'); + const main = tmpdir.resolve('bundle.js'); + const output = tmpdir.resolve('output-dir'); mkdirSync(output); writeFileSync(main, 'console.log("hello")', 'utf-8'); const configJson = JSON.stringify({ diff --git a/test/parallel/test-single-executable-blob-config.js b/test/parallel/test-single-executable-blob-config.js index c96bc735204ddb..4d56bc35066715 100644 --- a/test/parallel/test-single-executable-blob-config.js +++ b/test/parallel/test-single-executable-blob-config.js @@ -6,13 +6,12 @@ const tmpdir = require('../common/tmpdir'); const { writeFileSync, existsSync } = require('fs'); const { spawnSync } = require('child_process'); const assert = require('assert'); -const { join } = require('path'); { tmpdir.refresh(); - const config = join(tmpdir.path, 'absolute.json'); - const main = join(tmpdir.path, 'bundle.js'); - const output = join(tmpdir.path, 'output.blob'); + const config = tmpdir.resolve('absolute.json'); + const main = tmpdir.resolve('bundle.js'); + const output = tmpdir.resolve('output.blob'); writeFileSync(main, 'console.log("hello")', 'utf-8'); const configJson = JSON.stringify({ main, @@ -30,9 +29,9 @@ const { join } = require('path'); { tmpdir.refresh(); - const config = join(tmpdir.path, 'relative.json'); - const main = join(tmpdir.path, 'bundle.js'); - const output = join(tmpdir.path, 'output.blob'); + const config = tmpdir.resolve('relative.json'); + const main = tmpdir.resolve('bundle.js'); + const output = tmpdir.resolve('output.blob'); writeFileSync(main, 'console.log("hello")', 'utf-8'); const configJson = JSON.stringify({ main: 'bundle.js', @@ -51,9 +50,9 @@ const { join } = require('path'); { tmpdir.refresh(); - const config = join(tmpdir.path, 'no-disableExperimentalSEAWarning.json'); - const main = join(tmpdir.path, 'bundle.js'); - const output = join(tmpdir.path, 'output.blob'); + const config = tmpdir.resolve('no-disableExperimentalSEAWarning.json'); + const main = tmpdir.resolve('bundle.js'); + const output = tmpdir.resolve('output.blob'); writeFileSync(main, 'console.log("hello")', 'utf-8'); const configJson = JSON.stringify({ main: 'bundle.js', @@ -72,9 +71,9 @@ const { join } = require('path'); { tmpdir.refresh(); - const config = join(tmpdir.path, 'true-disableExperimentalSEAWarning.json'); - const main = join(tmpdir.path, 'bundle.js'); - const output = join(tmpdir.path, 'output.blob'); + const config = tmpdir.resolve('true-disableExperimentalSEAWarning.json'); + const main = tmpdir.resolve('bundle.js'); + const output = tmpdir.resolve('output.blob'); writeFileSync(main, 'console.log("hello")', 'utf-8'); const configJson = JSON.stringify({ main: 'bundle.js', @@ -94,9 +93,9 @@ const { join } = require('path'); { tmpdir.refresh(); - const config = join(tmpdir.path, 'false-disableExperimentalSEAWarning.json'); - const main = join(tmpdir.path, 'bundle.js'); - const output = join(tmpdir.path, 'output.blob'); + const config = tmpdir.resolve('false-disableExperimentalSEAWarning.json'); + const main = tmpdir.resolve('bundle.js'); + const output = tmpdir.resolve('output.blob'); writeFileSync(main, 'console.log("hello")', 'utf-8'); const configJson = JSON.stringify({ main: 'bundle.js', diff --git a/test/parallel/test-source-map-enable.js b/test/parallel/test-source-map-enable.js index dc00cf624ae8ea..5038aff360e518 100644 --- a/test/parallel/test-source-map-enable.js +++ b/test/parallel/test-source-map-enable.js @@ -16,7 +16,7 @@ tmpdir.refresh(); let dirc = 0; function nextdir() { return process.env.NODE_V8_COVERAGE || - path.join(tmpdir.path, `source_map_${++dirc}`); + tmpdir.resolve(`source_map_${++dirc}`); } // Outputs source maps when event loop is drained, with no async logic. diff --git a/test/parallel/test-stdin-from-file.js b/test/parallel/test-stdin-from-file.js index f4fcb32edbfde5..7c263d1858a556 100644 --- a/test/parallel/test-stdin-from-file.js +++ b/test/parallel/test-stdin-from-file.js @@ -3,12 +3,11 @@ const common = require('../common'); const fixtures = require('../common/fixtures'); const tmpdir = require('../common/tmpdir'); const assert = require('assert'); -const { join } = require('path'); const childProcess = require('child_process'); const fs = require('fs'); const stdoutScript = fixtures.path('echo-close-check.js'); -const tmpFile = join(tmpdir.path, 'stdin.txt'); +const tmpFile = tmpdir.resolve('stdin.txt'); const cmd = `"${process.argv[0]}" "${stdoutScript}" < "${tmpFile}"`; diff --git a/test/parallel/test-stdio-pipe-stderr.js b/test/parallel/test-stdio-pipe-stderr.js index 1737424bb049fc..c914877062c425 100644 --- a/test/parallel/test-stdio-pipe-stderr.js +++ b/test/parallel/test-stdio-pipe-stderr.js @@ -3,7 +3,6 @@ require('../common'); const tmpdir = require('../common/tmpdir'); const assert = require('assert'); const fs = require('fs'); -const join = require('path').join; const { spawnSync } = require('child_process'); // Test that invoking node with require, and piping stderr to file, @@ -11,8 +10,8 @@ const { spawnSync } = require('child_process'); // see: https://github.com/nodejs/node/issues/11257 tmpdir.refresh(); -const fakeModulePath = join(tmpdir.path, 'batman.js'); -const stderrOutputPath = join(tmpdir.path, 'stderr-output.txt'); +const fakeModulePath = tmpdir.resolve('batman.js'); +const stderrOutputPath = tmpdir.resolve('stderr-output.txt'); // We need to redirect stderr to a file to produce #11257 const stream = fs.createWriteStream(stderrOutputPath); diff --git a/test/parallel/test-stdout-to-file.js b/test/parallel/test-stdout-to-file.js index d66f382af5c1f8..9114f22443139c 100644 --- a/test/parallel/test-stdout-to-file.js +++ b/test/parallel/test-stdout-to-file.js @@ -1,7 +1,6 @@ 'use strict'; const common = require('../common'); const assert = require('assert'); -const path = require('path'); const childProcess = require('child_process'); const fs = require('fs'); const fixtures = require('../common/fixtures'); @@ -9,7 +8,7 @@ const tmpdir = require('../common/tmpdir'); const scriptString = fixtures.path('print-chars.js'); const scriptBuffer = fixtures.path('print-chars-from-buffer.js'); -const tmpFile = path.join(tmpdir.path, 'stdout.txt'); +const tmpFile = tmpdir.resolve('stdout.txt'); tmpdir.refresh(); diff --git a/test/parallel/test-tls-enable-keylog-cli.js b/test/parallel/test-tls-enable-keylog-cli.js index 128d9a096a0532..68378d0c6d0dfa 100644 --- a/test/parallel/test-tls-enable-keylog-cli.js +++ b/test/parallel/test-tls-enable-keylog-cli.js @@ -6,7 +6,6 @@ const fixtures = require('../common/fixtures'); // Test --tls-keylog CLI flag. const assert = require('assert'); -const path = require('path'); const fs = require('fs'); const { fork } = require('child_process'); @@ -15,7 +14,7 @@ if (process.argv[2] === 'test') const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const file = path.resolve(tmpdir.path, 'keylog.log'); +const file = tmpdir.resolve('keylog.log'); const child = fork(__filename, ['test'], { execArgv: ['--tls-keylog=' + file] diff --git a/test/parallel/test-v8-coverage.js b/test/parallel/test-v8-coverage.js index ca5301b8bd08e0..72e57a55716617 100644 --- a/test/parallel/test-v8-coverage.js +++ b/test/parallel/test-v8-coverage.js @@ -18,7 +18,7 @@ function nextdir() { // Outputs coverage when event loop is drained, with no async logic. { - const coverageDirectory = path.join(tmpdir.path, nextdir()); + const coverageDirectory = tmpdir.resolve(nextdir()); const output = spawnSync(process.execPath, [ require.resolve('../fixtures/v8-coverage/basic'), ], { env: { ...process.env, NODE_V8_COVERAGE: coverageDirectory } }); @@ -37,7 +37,7 @@ function nextdir() { // Outputs coverage when error is thrown in first tick. { - const coverageDirectory = path.join(tmpdir.path, nextdir()); + const coverageDirectory = tmpdir.resolve(nextdir()); const output = spawnSync(process.execPath, [ require.resolve('../fixtures/v8-coverage/throw'), ], { env: { ...process.env, NODE_V8_COVERAGE: coverageDirectory } }); @@ -55,7 +55,7 @@ function nextdir() { // Outputs coverage when process.exit(1) exits process. { - const coverageDirectory = path.join(tmpdir.path, nextdir()); + const coverageDirectory = tmpdir.resolve(nextdir()); const output = spawnSync(process.execPath, [ require.resolve('../fixtures/v8-coverage/exit-1'), ], { env: { ...process.env, NODE_V8_COVERAGE: coverageDirectory } }); @@ -74,7 +74,7 @@ function nextdir() { // Outputs coverage when process.kill(process.pid, "SIGINT"); exits process. { - const coverageDirectory = path.join(tmpdir.path, nextdir()); + const coverageDirectory = tmpdir.resolve(nextdir()); const output = spawnSync(process.execPath, [ require.resolve('../fixtures/v8-coverage/sigint'), ], { env: { ...process.env, NODE_V8_COVERAGE: coverageDirectory } }); @@ -95,7 +95,7 @@ function nextdir() { // Outputs coverage from subprocess. { - const coverageDirectory = path.join(tmpdir.path, nextdir()); + const coverageDirectory = tmpdir.resolve(nextdir()); const output = spawnSync(process.execPath, [ require.resolve('../fixtures/v8-coverage/spawn-subprocess'), ], { env: { ...process.env, NODE_V8_COVERAGE: coverageDirectory } }); @@ -115,7 +115,7 @@ function nextdir() { // Outputs coverage from worker. { - const coverageDirectory = path.join(tmpdir.path, nextdir()); + const coverageDirectory = tmpdir.resolve(nextdir()); const output = spawnSync(process.execPath, [ require.resolve('../fixtures/v8-coverage/worker'), ], { env: { ...process.env, NODE_V8_COVERAGE: coverageDirectory } }); @@ -135,7 +135,7 @@ function nextdir() { // Does not output coverage if NODE_V8_COVERAGE is empty. { - const coverageDirectory = path.join(tmpdir.path, nextdir()); + const coverageDirectory = tmpdir.resolve(nextdir()); const output = spawnSync(process.execPath, [ require.resolve('../fixtures/v8-coverage/spawn-subprocess-no-cov'), ], { env: { ...process.env, NODE_V8_COVERAGE: coverageDirectory } }); @@ -151,7 +151,7 @@ function nextdir() { // Disables async hooks before writing coverage. { - const coverageDirectory = path.join(tmpdir.path, nextdir()); + const coverageDirectory = tmpdir.resolve(nextdir()); const output = spawnSync(process.execPath, [ require.resolve('../fixtures/v8-coverage/async-hooks'), ], { env: { ...process.env, NODE_V8_COVERAGE: coverageDirectory } }); @@ -170,7 +170,7 @@ function nextdir() { // Outputs coverage when the coverage directory is not absolute. { const coverageDirectory = nextdir(); - const absoluteCoverageDirectory = path.join(tmpdir.path, coverageDirectory); + const absoluteCoverageDirectory = tmpdir.resolve(coverageDirectory); const output = spawnSync(process.execPath, [ require.resolve('../fixtures/v8-coverage/basic'), ], { diff --git a/test/parallel/test-v8-take-coverage.js b/test/parallel/test-v8-take-coverage.js index b5e99ac30a5717..644f8201dec8b3 100644 --- a/test/parallel/test-v8-take-coverage.js +++ b/test/parallel/test-v8-take-coverage.js @@ -7,7 +7,6 @@ const fixtures = require('../common/fixtures'); const tmpdir = require('../common/tmpdir'); const assert = require('assert'); const fs = require('fs'); -const path = require('path'); const { spawnSync } = require('child_process'); tmpdir.refresh(); @@ -32,7 +31,7 @@ const intervals = 40; let coverages = []; for (const coverageFile of coverageFiles) { - const coverage = require(path.join(tmpdir.path, coverageFile)); + const coverage = require(tmpdir.resolve(coverageFile)); for (const result of coverage.result) { if (result.url.includes('/interval')) { coverages.push({ diff --git a/test/parallel/test-vfs.js b/test/parallel/test-vfs.js index 84e77f4bd58cd8..3ce8f8344a9ca2 100644 --- a/test/parallel/test-vfs.js +++ b/test/parallel/test-vfs.js @@ -9,9 +9,9 @@ const tmpdir = require('../common/tmpdir'); const { deepStrictEqual, ok, strictEqual, throws } = require('assert'); const { join } = require('path'); -const directory = join(tmpdir.path, 'directory'); -const doesNotExist = join(tmpdir.path, 'does-not-exist'); -const file = join(tmpdir.path, 'file.js'); +const directory = tmpdir.resolve('directory'); +const doesNotExist = tmpdir.resolve('does-not-exist'); +const file = tmpdir.resolve('file.js'); tmpdir.refresh(); fs.writeFileSync(file, "module.exports = { a: 'b' }"); diff --git a/test/parallel/test-watch-mode-files_watcher.mjs b/test/parallel/test-watch-mode-files_watcher.mjs index a059eb30dc63d9..fec26892771fcf 100644 --- a/test/parallel/test-watch-mode-files_watcher.mjs +++ b/test/parallel/test-watch-mode-files_watcher.mjs @@ -44,7 +44,7 @@ describe('watch mode file watcher', () => { } it('should watch changed files', async () => { - const file = path.join(tmpdir.path, 'file1'); + const file = tmpdir.resolve('file1'); writeFileSync(file, 'written'); watcher.filterFile(file); await writeAndWaitForChanges(watcher, file); @@ -52,7 +52,7 @@ describe('watch mode file watcher', () => { }); it('should debounce changes', async () => { - const file = path.join(tmpdir.path, 'file2'); + const file = tmpdir.resolve('file2'); writeFileSync(file, 'written'); watcher.filterFile(file); await writeAndWaitForChanges(watcher, file); @@ -74,13 +74,13 @@ describe('watch mode file watcher', () => { { skip: !supportsRecursiveWatching }, async () => { watcher.on('changed', common.mustNotCall()); watcher.watchPath(tmpdir.path); - writeFileSync(path.join(tmpdir.path, 'file3'), '1'); + writeFileSync(tmpdir.resolve('file3'), '1'); // Wait for this long to make sure changes are not triggered await setTimeout(1000); }); it('should allow clearing filters', async () => { - const file = path.join(tmpdir.path, 'file4'); + const file = tmpdir.resolve('file4'); writeFileSync(file, 'written'); watcher.filterFile(file); await writeAndWaitForChanges(watcher, file); @@ -100,7 +100,7 @@ describe('watch mode file watcher', () => { watcher = new FilesWatcher({ debounce: 100, mode: 'all' }); watcher.on('changed', () => changesCount++); - const file = path.join(tmpdir.path, 'file5'); + const file = tmpdir.resolve('file5'); watcher.watchPath(tmpdir.path); const changed = once(watcher, 'changed'); @@ -124,14 +124,14 @@ describe('watch mode file watcher', () => { assert.deepStrictEqual(watcher.watchedPaths, []); watcher.watchPath(tmpdir.path); assert.deepStrictEqual(watcher.watchedPaths, [tmpdir.path]); - watcher.watchPath(path.join(tmpdir.path, 'subdirectory')); + watcher.watchPath(tmpdir.resolve('subdirectory')); assert.deepStrictEqual(watcher.watchedPaths, [tmpdir.path]); }); it('should remove existing watcher if adding a parent directory watcher', { skip: !supportsRecursiveWatching }, () => { assert.deepStrictEqual(watcher.watchedPaths, []); - const subdirectory = path.join(tmpdir.path, 'subdirectory'); + const subdirectory = tmpdir.resolve('subdirectory'); mkdirSync(subdirectory); watcher.watchPath(subdirectory); assert.deepStrictEqual(watcher.watchedPaths, [subdirectory]); @@ -153,7 +153,7 @@ describe('watch mode file watcher', () => { const child = spawn(process.execPath, [file], { stdio: ['pipe', 'pipe', 'pipe', 'ipc'], encoding: 'utf8' }); watcher.watchChildProcessModules(child); await once(child, 'exit'); - let expected = [file, path.join(tmpdir.path, 'file')]; + let expected = [file, tmpdir.resolve('file')]; if (supportsRecursiveWatching) { expected = expected.map((file) => path.dirname(file)); } diff --git a/test/parallel/test-worker-esm-missing-main.js b/test/parallel/test-worker-esm-missing-main.js index 51dba34a7916c7..0b1245d108cda8 100644 --- a/test/parallel/test-worker-esm-missing-main.js +++ b/test/parallel/test-worker-esm-missing-main.js @@ -1,12 +1,11 @@ 'use strict'; const common = require('../common'); const assert = require('assert'); -const path = require('path'); const { Worker } = require('worker_threads'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const missing = path.join(tmpdir.path, 'does-not-exist.js'); +const missing = tmpdir.resolve('does-not-exist.js'); const worker = new Worker(missing); diff --git a/test/parallel/test-zlib-brotli-from-brotli.js b/test/parallel/test-zlib-brotli-from-brotli.js index a0afc425d25a6d..7e6bfb419e2aa7 100644 --- a/test/parallel/test-zlib-brotli-from-brotli.js +++ b/test/parallel/test-zlib-brotli-from-brotli.js @@ -5,7 +5,6 @@ const common = require('../common'); const assert = require('assert'); const zlib = require('zlib'); -const path = require('path'); const fixtures = require('../common/fixtures'); const tmpdir = require('../common/tmpdir'); @@ -17,7 +16,7 @@ const fs = require('fs'); const fixture = fixtures.path('person.jpg.br'); const unzippedFixture = fixtures.path('person.jpg'); -const outputFile = path.resolve(tmpdir.path, 'person.jpg'); +const outputFile = tmpdir.resolve('person.jpg'); const expect = fs.readFileSync(unzippedFixture); const inp = fs.createReadStream(fixture); const out = fs.createWriteStream(outputFile); diff --git a/test/parallel/test-zlib-from-gzip.js b/test/parallel/test-zlib-from-gzip.js index 277df3c4cc2bc3..f8fbe167649e93 100644 --- a/test/parallel/test-zlib-from-gzip.js +++ b/test/parallel/test-zlib-from-gzip.js @@ -26,7 +26,6 @@ const common = require('../common'); const assert = require('assert'); const zlib = require('zlib'); -const path = require('path'); const fixtures = require('../common/fixtures'); const tmpdir = require('../common/tmpdir'); @@ -38,7 +37,7 @@ const fs = require('fs'); const fixture = fixtures.path('person.jpg.gz'); const unzippedFixture = fixtures.path('person.jpg'); -const outputFile = path.resolve(tmpdir.path, 'person.jpg'); +const outputFile = tmpdir.resolve('person.jpg'); const expect = fs.readFileSync(unzippedFixture); const inp = fs.createReadStream(fixture); const out = fs.createWriteStream(outputFile);