From 8d0bc391640d87c3e07ed140113cfcade93c9ae8 Mon Sep 17 00:00:00 2001 From: LiviaMedeiros Date: Thu, 10 Aug 2023 17:28:30 +0800 Subject: [PATCH] test: use `tmpdir.resolve()` --- test/addons/symlinked-module/test.js | 2 +- test/async-hooks/test-statwatcher.js | 5 ++--- test/common/snapshot.js | 7 +++---- test/doctool/test-apilinks.mjs | 2 +- test/doctool/test-doctool-versions.mjs | 3 +-- test/embedding/test-embedding.js | 4 ++-- .../test-esm-extension-lookup-deprecation.mjs | 12 ++++++------ test/es-module/test-esm-resolve-type.mjs | 2 +- test/es-module/test-esm-symlink-main.js | 2 +- test/es-module/test-esm-windows.js | 2 +- test/fixtures/test-runner/concurrency/a.mjs | 4 ++-- test/fixtures/test-runner/concurrency/b.mjs | 4 ++-- test/fixtures/watch-mode/ipc.js | 2 +- test/internet/test-corepack-yarn-install.js | 6 +++--- test/internet/test-trace-events-dns.js | 3 +-- test/node-api/test_general/test.js | 2 +- test/node-api/test_policy/test_policy.js | 3 +-- test/pummel/test-fs-largefile.js | 3 +-- test/pummel/test-fs-readfile-tostring-fail.js | 3 +-- test/pummel/test-fs-watch-file-slow.js | 3 +-- test/pummel/test-policy-integrity-dep.js | 2 +- .../test-policy-integrity-parent-commonjs.js | 2 +- test/pummel/test-policy-integrity-parent-module.js | 2 +- ...test-policy-integrity-parent-no-package-json.js | 2 +- .../test-policy-integrity-worker-commonjs.js | 2 +- test/pummel/test-policy-integrity-worker-module.js | 2 +- ...test-policy-integrity-worker-no-package-json.js | 2 +- test/pummel/test-watch-file.js | 3 +-- test/report/test-report-writereport.js | 6 +++--- test/sequential/test-cpu-prof-dir-absolute.js | 3 +-- test/sequential/test-cpu-prof-dir-and-name.js | 2 +- test/sequential/test-cpu-prof-dir-relative.js | 3 +-- test/sequential/test-cpu-prof-dir-worker.js | 3 +-- test/sequential/test-cpu-prof-name.js | 3 +-- test/sequential/test-diagnostic-dir-cpu-prof.js | 7 +++---- test/sequential/test-diagnostic-dir-heap-prof.js | 6 +++--- .../test-http2-timeout-large-write-file.js | 3 +-- ...application-disable-experimental-sea-warning.js | 10 +++++----- .../test-single-executable-application-empty.js | 9 ++++----- .../test-single-executable-application-snapshot.js | 11 +++++------ ...single-executable-application-use-code-cache.js | 10 +++++----- .../test-single-executable-application.js | 10 +++++----- test/sequential/test-tls-session-timeout.js | 3 +-- test/sequential/test-watch-mode.mjs | 14 +++++++------- test/sequential/test-worker-prof.js | 3 +-- .../test-tick-processor-polyfill-brokenfile.js | 3 +-- test/tick-processor/tick-processor-base.js | 3 +-- test/wasi/test-wasi-stdio.js | 6 +++--- test/wasi/test-wasi-symlinks.js | 6 +++--- 49 files changed, 97 insertions(+), 118 deletions(-) diff --git a/test/addons/symlinked-module/test.js b/test/addons/symlinked-module/test.js index d47a84b98d1ed8..5a98db77771b5a 100644 --- a/test/addons/symlinked-module/test.js +++ b/test/addons/symlinked-module/test.js @@ -16,7 +16,7 @@ const tmpdir = require('../../common/tmpdir'); tmpdir.refresh(); const addonPath = path.join(__dirname, 'build', common.buildType); -const addonLink = path.join(tmpdir.path, 'addon'); +const addonLink = tmpdir.resolve('addon'); try { fs.symlinkSync(addonPath, addonLink, 'dir'); diff --git a/test/async-hooks/test-statwatcher.js b/test/async-hooks/test-statwatcher.js index b8651ab8e0431e..f3c0e74355eeba 100644 --- a/test/async-hooks/test-statwatcher.js +++ b/test/async-hooks/test-statwatcher.js @@ -6,15 +6,14 @@ const assert = require('assert'); const initHooks = require('./init-hooks'); const { checkInvocations } = require('./hook-checks'); const fs = require('fs'); -const path = require('path'); if (!common.isMainThread) common.skip('Worker bootstrapping works differently -> different async IDs'); tmpdir.refresh(); -const file1 = path.join(tmpdir.path, 'file1'); -const file2 = path.join(tmpdir.path, 'file2'); +const file1 = tmpdir.resolve('file1'); +const file2 = tmpdir.resolve('file2'); const onchangex = (x) => (curr, prev) => { console.log(`Watcher: ${x}`); diff --git a/test/common/snapshot.js b/test/common/snapshot.js index 3037ce45639eb9..4a46533facb6fa 100644 --- a/test/common/snapshot.js +++ b/test/common/snapshot.js @@ -2,14 +2,13 @@ const tmpdir = require('../common/tmpdir'); const { spawnSync } = require('child_process'); -const path = require('path'); const fs = require('fs'); const assert = require('assert'); function buildSnapshot(entry, env) { const child = spawnSync(process.execPath, [ '--snapshot-blob', - path.join(tmpdir.path, 'snapshot.blob'), + tmpdir.resolve('snapshot.blob'), '--build-snapshot', entry, ], { @@ -29,14 +28,14 @@ function buildSnapshot(entry, env) { assert.strictEqual(child.status, 0); - const stats = fs.statSync(path.join(tmpdir.path, 'snapshot.blob')); + const stats = fs.statSync(tmpdir.resolve('snapshot.blob')); assert(stats.isFile()); return { child, stderr, stdout }; } function runWithSnapshot(entry, env) { - const args = ['--snapshot-blob', path.join(tmpdir.path, 'snapshot.blob')]; + const args = ['--snapshot-blob', tmpdir.resolve('snapshot.blob')]; if (entry !== undefined) { args.push(entry); } diff --git a/test/doctool/test-apilinks.mjs b/test/doctool/test-apilinks.mjs index fbbfafc139b711..70b7b4ef8e21c4 100644 --- a/test/doctool/test-apilinks.mjs +++ b/test/doctool/test-apilinks.mjs @@ -19,7 +19,7 @@ fs.readdirSync(apilinks).forEach((fixture) => { const input = path.join(apilinks, fixture); const expectedContent = fs.readFileSync(`${input}on`, 'utf8'); - const outputPath = path.join(tmpdir.path, `${fixture}on`); + const outputPath = tmpdir.resolve(`${fixture}on`); execFileSync( process.execPath, [script, outputPath, input], diff --git a/test/doctool/test-doctool-versions.mjs b/test/doctool/test-doctool-versions.mjs index 10eb8467bb110c..ba5d7291064685 100644 --- a/test/doctool/test-doctool-versions.mjs +++ b/test/doctool/test-doctool-versions.mjs @@ -4,7 +4,6 @@ import tmpdir from '../common/tmpdir.js'; import assert from 'assert'; import { spawnSync } from 'child_process'; import fs from 'fs'; -import path from 'path'; import { fileURLToPath } from 'url'; import util from 'util'; @@ -29,7 +28,7 @@ const expected = [ ]; tmpdir.refresh(); -const versionsFile = path.join(tmpdir.path, 'versions.json'); +const versionsFile = tmpdir.resolve('versions.json'); debuglog(`${process.execPath} ${versionsTool} ${versionsFile}`); const opts = { cwd: tmpdir.path, encoding: 'utf8' }; const cp = spawnSync(process.execPath, [ versionsTool, versionsFile ], opts); diff --git a/test/embedding/test-embedding.js b/test/embedding/test-embedding.js index a0ac4834b566eb..5d448b78a433e8 100644 --- a/test/embedding/test-embedding.js +++ b/test/embedding/test-embedding.js @@ -63,7 +63,7 @@ function getReadFileCodeForPath(path) { for (const extraSnapshotArgs of [[], ['--embedder-snapshot-as-file']]) { // readSync + eval since snapshots don't support userland require() (yet) const snapshotFixture = fixtures.path('snapshot', 'echo-args.js'); - const blobPath = path.join(tmpdir.path, 'embedder-snapshot.blob'); + const blobPath = tmpdir.resolve('embedder-snapshot.blob'); const buildSnapshotArgs = [ `eval(${getReadFileCodeForPath(snapshotFixture)})`, 'arg1', 'arg2', '--embedder-snapshot-blob', blobPath, '--embedder-snapshot-create', @@ -94,7 +94,7 @@ for (const extraSnapshotArgs of [[], ['--embedder-snapshot-as-file']]) { // Create workers and vm contexts after deserialization { const snapshotFixture = fixtures.path('snapshot', 'create-worker-and-vm.js'); - const blobPath = path.join(tmpdir.path, 'embedder-snapshot.blob'); + const blobPath = tmpdir.resolve('embedder-snapshot.blob'); const buildSnapshotArgs = [ `eval(${getReadFileCodeForPath(snapshotFixture)})`, '--embedder-snapshot-blob', blobPath, '--embedder-snapshot-create', diff --git a/test/es-module/test-esm-extension-lookup-deprecation.mjs b/test/es-module/test-esm-extension-lookup-deprecation.mjs index e8da1a8b176bc7..be6ea5bb6f88bc 100644 --- a/test/es-module/test-esm-extension-lookup-deprecation.mjs +++ b/test/es-module/test-esm-extension-lookup-deprecation.mjs @@ -11,7 +11,7 @@ describe('ESM in main field', { concurrency: true }, () => { before(() => tmpdir.refresh()); it('should handle fully-specified relative path without any warning', async () => { - const cwd = path.join(tmpdir.path, Math.random().toString()); + const cwd = tmpdir.resolve(Math.random().toString()); const pkgPath = path.join(cwd, './node_modules/pkg/'); await mkdir(pkgPath, { recursive: true }); await writeFile(path.join(pkgPath, './index.js'), 'console.log("Hello World!")'); @@ -29,7 +29,7 @@ describe('ESM in main field', { concurrency: true }, () => { assert.strictEqual(code, 0); }); it('should handle fully-specified absolute path without any warning', async () => { - const cwd = path.join(tmpdir.path, Math.random().toString()); + const cwd = tmpdir.resolve(Math.random().toString()); const pkgPath = path.join(cwd, './node_modules/pkg/'); await mkdir(pkgPath, { recursive: true }); await writeFile(path.join(pkgPath, './index.js'), 'console.log("Hello World!")'); @@ -48,7 +48,7 @@ describe('ESM in main field', { concurrency: true }, () => { }); it('should emit warning when "main" and "exports" are missing', async () => { - const cwd = path.join(tmpdir.path, Math.random().toString()); + const cwd = tmpdir.resolve(Math.random().toString()); const pkgPath = path.join(cwd, './node_modules/pkg/'); await mkdir(pkgPath, { recursive: true }); await writeFile(path.join(pkgPath, './index.js'), 'console.log("Hello World!")'); @@ -65,7 +65,7 @@ describe('ESM in main field', { concurrency: true }, () => { assert.strictEqual(code, 0); }); it('should emit warning when "main" is falsy', async () => { - const cwd = path.join(tmpdir.path, Math.random().toString()); + const cwd = tmpdir.resolve(Math.random().toString()); const pkgPath = path.join(cwd, './node_modules/pkg/'); await mkdir(pkgPath, { recursive: true }); await writeFile(path.join(pkgPath, './index.js'), 'console.log("Hello World!")'); @@ -83,7 +83,7 @@ describe('ESM in main field', { concurrency: true }, () => { assert.strictEqual(code, 0); }); it('should emit warning when "main" is a relative path without extension', async () => { - const cwd = path.join(tmpdir.path, Math.random().toString()); + const cwd = tmpdir.resolve(Math.random().toString()); const pkgPath = path.join(cwd, './node_modules/pkg/'); await mkdir(pkgPath, { recursive: true }); await writeFile(path.join(pkgPath, './index.js'), 'console.log("Hello World!")'); @@ -101,7 +101,7 @@ describe('ESM in main field', { concurrency: true }, () => { assert.strictEqual(code, 0); }); it('should emit warning when "main" is an absolute path without extension', async () => { - const cwd = path.join(tmpdir.path, Math.random().toString()); + const cwd = tmpdir.resolve(Math.random().toString()); const pkgPath = path.join(cwd, './node_modules/pkg/'); await mkdir(pkgPath, { recursive: true }); await writeFile(path.join(pkgPath, './index.js'), 'console.log("Hello World!")'); diff --git a/test/es-module/test-esm-resolve-type.mjs b/test/es-module/test-esm-resolve-type.mjs index 7a0527ff59e554..0f442ed569f848 100644 --- a/test/es-module/test-esm-resolve-type.mjs +++ b/test/es-module/test-esm-resolve-type.mjs @@ -26,7 +26,7 @@ const { defaultResolve: resolve } = internalResolve; -const rel = (file) => path.join(tmpdir.path, file); +const rel = (file) => tmpdir.resolve(file); const previousCwd = process.cwd(); const nmDir = rel('node_modules'); diff --git a/test/es-module/test-esm-symlink-main.js b/test/es-module/test-esm-symlink-main.js index 48b4d8bbe65daf..2be495ad7dcfb5 100644 --- a/test/es-module/test-esm-symlink-main.js +++ b/test/es-module/test-esm-symlink-main.js @@ -9,7 +9,7 @@ const fs = require('fs'); tmpdir.refresh(); const realPath = path.resolve(__dirname, '../fixtures/es-modules/symlink.mjs'); -const symlinkPath = path.resolve(tmpdir.path, 'symlink.mjs'); +const symlinkPath = tmpdir.resolve('symlink.mjs'); try { fs.symlinkSync(realPath, symlinkPath); diff --git a/test/es-module/test-esm-windows.js b/test/es-module/test-esm-windows.js index 76e016217b3ef8..e5c52226ab001d 100644 --- a/test/es-module/test-esm-windows.js +++ b/test/es-module/test-esm-windows.js @@ -15,7 +15,7 @@ const imp = (file) => { (async () => { tmpdir.refresh(); - const rel = (file) => path.join(tmpdir.path, file); + const rel = (file) => tmpdir.resolve(file); { // Load a single script const file = rel('con.mjs'); diff --git a/test/fixtures/test-runner/concurrency/a.mjs b/test/fixtures/test-runner/concurrency/a.mjs index 69954461bfbae0..a34b87e82055ad 100644 --- a/test/fixtures/test-runner/concurrency/a.mjs +++ b/test/fixtures/test-runner/concurrency/a.mjs @@ -3,9 +3,9 @@ import { setTimeout } from 'node:timers/promises'; import fs from 'node:fs/promises'; import path from 'node:path'; -await fs.writeFile(path.resolve(tmpdir.path, 'test-runner-concurrency'), 'a.mjs'); +await fs.writeFile(tmpdir.resolve('test-runner-concurrency'), 'a.mjs'); while (true) { - const file = await fs.readFile(path.resolve(tmpdir.path, 'test-runner-concurrency'), 'utf8'); + const file = await fs.readFile(tmpdir.resolve('test-runner-concurrency'), 'utf8'); if (file === 'b.mjs') { break; } diff --git a/test/fixtures/test-runner/concurrency/b.mjs b/test/fixtures/test-runner/concurrency/b.mjs index 09af543a2551eb..395cea1df47b68 100644 --- a/test/fixtures/test-runner/concurrency/b.mjs +++ b/test/fixtures/test-runner/concurrency/b.mjs @@ -4,9 +4,9 @@ import fs from 'node:fs/promises'; import path from 'node:path'; while (true) { - const file = await fs.readFile(path.resolve(tmpdir.path, 'test-runner-concurrency'), 'utf8'); + const file = await fs.readFile(tmpdir.resolve('test-runner-concurrency'), 'utf8'); if (file === 'a.mjs') { - await fs.writeFile(path.resolve(tmpdir.path, 'test-runner-concurrency'), 'b.mjs'); + await fs.writeFile(tmpdir.resolve('test-runner-concurrency'), 'b.mjs'); break; } await setTimeout(10); diff --git a/test/fixtures/watch-mode/ipc.js b/test/fixtures/watch-mode/ipc.js index 5881299387e5b4..d2a5a63854f8f9 100644 --- a/test/fixtures/watch-mode/ipc.js +++ b/test/fixtures/watch-mode/ipc.js @@ -3,7 +3,7 @@ const url = require('node:url'); const fs = require('node:fs'); const tmpdir = require('../../common/tmpdir'); -const tmpfile = path.join(tmpdir.path, 'file'); +const tmpfile = tmpdir.resolve('file'); fs.writeFileSync(tmpfile, ''); process.send({ 'watch:require': [path.resolve(__filename)] }); diff --git a/test/internet/test-corepack-yarn-install.js b/test/internet/test-corepack-yarn-install.js index 48a9bdb44cd75f..80c2285cc23c6c 100644 --- a/test/internet/test-corepack-yarn-install.js +++ b/test/internet/test-corepack-yarn-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 corepackYarnPath = path.join( diff --git a/test/internet/test-trace-events-dns.js b/test/internet/test-trace-events-dns.js index 64efd541fd9d2c..c18a49bc9496c8 100644 --- a/test/internet/test-trace-events-dns.js +++ b/test/internet/test-trace-events-dns.js @@ -2,7 +2,6 @@ const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); -const path = require('path'); const tmpdir = require('../common/tmpdir'); const fs = require('fs'); const util = require('util'); @@ -57,7 +56,7 @@ for (const tr in tests) { throw new Error(`${tr}:\n${util.inspect(proc)}`); } - const file = path.join(tmpdir.path, traceFile); + const file = tmpdir.resolve(traceFile); const data = fs.readFileSync(file); const traces = JSON.parse(data.toString()).traceEvents diff --git a/test/node-api/test_general/test.js b/test/node-api/test_general/test.js index 397bb3c91f629b..c7dd70f2da5f17 100644 --- a/test/node-api/test_general/test.js +++ b/test/node-api/test_general/test.js @@ -19,7 +19,7 @@ tmpdir.refresh(); } { - const urlTestDir = path.join(tmpdir.path, 'foo%#bar'); + const urlTestDir = tmpdir.resolve('foo%#bar'); const urlTestFile = path.join(urlTestDir, path.basename(filename)); fs.mkdirSync(urlTestDir, { recursive: true }); fs.copyFileSync(filename, urlTestFile); diff --git a/test/node-api/test_policy/test_policy.js b/test/node-api/test_policy/test_policy.js index d6cb12b56cb683..428dd905c2e365 100644 --- a/test/node-api/test_policy/test_policy.js +++ b/test/node-api/test_policy/test_policy.js @@ -8,7 +8,6 @@ const tmpdir = require('../../common/tmpdir'); const { spawnSync } = require('child_process'); const crypto = require('crypto'); const fs = require('fs'); -const path = require('path'); const { pathToFileURL } = require('url'); tmpdir.refresh(); @@ -19,7 +18,7 @@ function hash(algo, body) { return h.digest('base64'); } -const policyFilepath = path.join(tmpdir.path, 'policy'); +const policyFilepath = tmpdir.resolve('policy'); const depFilepath = require.resolve(`./build/${common.buildType}/binding.node`); const depURL = pathToFileURL(depFilepath); diff --git a/test/pummel/test-fs-largefile.js b/test/pummel/test-fs-largefile.js index 7f2630f497b817..486f23106f21df 100644 --- a/test/pummel/test-fs-largefile.js +++ b/test/pummel/test-fs-largefile.js @@ -24,14 +24,13 @@ const common = require('../common'); const assert = require('assert'); const fs = require('fs'); -const path = require('path'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); try { - const filepath = path.join(tmpdir.path, 'large.txt'); + const filepath = tmpdir.resolve('large.txt'); const fd = fs.openSync(filepath, 'w+'); const offset = 5 * 1024 * 1024 * 1024; // 5GB const message = 'Large File'; diff --git a/test/pummel/test-fs-readfile-tostring-fail.js b/test/pummel/test-fs-readfile-tostring-fail.js index 8428f1f15a0c22..8ffe630076a52d 100644 --- a/test/pummel/test-fs-readfile-tostring-fail.js +++ b/test/pummel/test-fs-readfile-tostring-fail.js @@ -7,7 +7,6 @@ if (!common.enoughTestMem) const assert = require('assert'); const fs = require('fs'); -const path = require('path'); const cp = require('child_process'); const kStringMaxLength = require('buffer').constants.MAX_STRING_LENGTH; if (common.isAIX && (Number(cp.execSync('ulimit -f')) * 512) < kStringMaxLength) @@ -20,7 +19,7 @@ if (!tmpdir.hasEnoughSpace(kStringMaxLength)) { common.skip(`Not enough space in ${tmpdir.path}`); } -const file = path.join(tmpdir.path, 'toobig.txt'); +const file = tmpdir.resolve('toobig.txt'); const stream = fs.createWriteStream(file, { flags: 'a', }); diff --git a/test/pummel/test-fs-watch-file-slow.js b/test/pummel/test-fs-watch-file-slow.js index c7513a18e6fa3e..c6d148df05db47 100644 --- a/test/pummel/test-fs-watch-file-slow.js +++ b/test/pummel/test-fs-watch-file-slow.js @@ -22,13 +22,12 @@ 'use strict'; require('../common'); const assert = require('assert'); -const path = require('path'); const fs = require('fs'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const FILENAME = path.join(tmpdir.path, 'watch-me'); +const FILENAME = tmpdir.resolve('watch-me'); const TIMEOUT = 1300; let nevents = 0; diff --git a/test/pummel/test-policy-integrity-dep.js b/test/pummel/test-policy-integrity-dep.js index 4611dec65007ee..d5a23d96bc2593 100644 --- a/test/pummel/test-policy-integrity-dep.js +++ b/test/pummel/test-policy-integrity-dep.js @@ -194,7 +194,7 @@ function drainQueue() { assert.notStrictEqual(status, 0, 'Should not allow multiple policies'); } { - const enoentFilepath = path.join(tmpdir.path, 'enoent'); + const enoentFilepath = tmpdir.resolve('enoent'); try { fs.unlinkSync(enoentFilepath); } catch { diff --git a/test/pummel/test-policy-integrity-parent-commonjs.js b/test/pummel/test-policy-integrity-parent-commonjs.js index d19a28bea5b5ad..07eee598117ba1 100644 --- a/test/pummel/test-policy-integrity-parent-commonjs.js +++ b/test/pummel/test-policy-integrity-parent-commonjs.js @@ -194,7 +194,7 @@ function drainQueue() { assert.notStrictEqual(status, 0, 'Should not allow multiple policies'); } { - const enoentFilepath = path.join(tmpdir.path, 'enoent'); + const enoentFilepath = tmpdir.resolve('enoent'); try { fs.unlinkSync(enoentFilepath); } catch { diff --git a/test/pummel/test-policy-integrity-parent-module.js b/test/pummel/test-policy-integrity-parent-module.js index 42f06d83ef0326..a09243ea10f529 100644 --- a/test/pummel/test-policy-integrity-parent-module.js +++ b/test/pummel/test-policy-integrity-parent-module.js @@ -194,7 +194,7 @@ function drainQueue() { assert.notStrictEqual(status, 0, 'Should not allow multiple policies'); } { - const enoentFilepath = path.join(tmpdir.path, 'enoent'); + const enoentFilepath = tmpdir.resolve('enoent'); try { fs.unlinkSync(enoentFilepath); } catch { diff --git a/test/pummel/test-policy-integrity-parent-no-package-json.js b/test/pummel/test-policy-integrity-parent-no-package-json.js index dd447c9fa843e4..a6461a9a5835c3 100644 --- a/test/pummel/test-policy-integrity-parent-no-package-json.js +++ b/test/pummel/test-policy-integrity-parent-no-package-json.js @@ -194,7 +194,7 @@ function drainQueue() { assert.notStrictEqual(status, 0, 'Should not allow multiple policies'); } { - const enoentFilepath = path.join(tmpdir.path, 'enoent'); + const enoentFilepath = tmpdir.resolve('enoent'); try { fs.unlinkSync(enoentFilepath); } catch { diff --git a/test/pummel/test-policy-integrity-worker-commonjs.js b/test/pummel/test-policy-integrity-worker-commonjs.js index 415e33664413cc..acc4298eb7b23b 100644 --- a/test/pummel/test-policy-integrity-worker-commonjs.js +++ b/test/pummel/test-policy-integrity-worker-commonjs.js @@ -211,7 +211,7 @@ function drainQueue() { assert.notStrictEqual(status, 0, 'Should not allow multiple policies'); } { - const enoentFilepath = path.join(tmpdir.path, 'enoent'); + const enoentFilepath = tmpdir.resolve('enoent'); try { fs.unlinkSync(enoentFilepath); } catch { diff --git a/test/pummel/test-policy-integrity-worker-module.js b/test/pummel/test-policy-integrity-worker-module.js index 813d167844104e..65a04841415da9 100644 --- a/test/pummel/test-policy-integrity-worker-module.js +++ b/test/pummel/test-policy-integrity-worker-module.js @@ -211,7 +211,7 @@ function drainQueue() { assert.notStrictEqual(status, 0, 'Should not allow multiple policies'); } { - const enoentFilepath = path.join(tmpdir.path, 'enoent'); + const enoentFilepath = tmpdir.resolve('enoent'); try { fs.unlinkSync(enoentFilepath); } catch { diff --git a/test/pummel/test-policy-integrity-worker-no-package-json.js b/test/pummel/test-policy-integrity-worker-no-package-json.js index 108af1b78e0697..fc90f73a03cf31 100644 --- a/test/pummel/test-policy-integrity-worker-no-package-json.js +++ b/test/pummel/test-policy-integrity-worker-no-package-json.js @@ -211,7 +211,7 @@ function drainQueue() { assert.notStrictEqual(status, 0, 'Should not allow multiple policies'); } { - const enoentFilepath = path.join(tmpdir.path, 'enoent'); + const enoentFilepath = tmpdir.resolve('enoent'); try { fs.unlinkSync(enoentFilepath); } catch { diff --git a/test/pummel/test-watch-file.js b/test/pummel/test-watch-file.js index bbbbf396d72227..6d55f08160a23b 100644 --- a/test/pummel/test-watch-file.js +++ b/test/pummel/test-watch-file.js @@ -24,11 +24,10 @@ require('../common'); const assert = require('assert'); const fs = require('fs'); -const path = require('path'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const f = path.join(tmpdir.path, 'x.txt'); +const f = tmpdir.resolve('x.txt'); fs.closeSync(fs.openSync(f, 'w')); let changes = 0; diff --git a/test/report/test-report-writereport.js b/test/report/test-report-writereport.js index 971afd84c22281..fd5430a14008e0 100644 --- a/test/report/test-report-writereport.js +++ b/test/report/test-report-writereport.js @@ -50,7 +50,7 @@ function validate() { { // Test with a file argument. const file = process.report.writeReport('custom-name-1.json'); - const absolutePath = path.join(tmpdir.path, file); + const absolutePath = tmpdir.resolve(file); assert.strictEqual(helper.findReports(process.pid, tmpdir.path).length, 0); assert.strictEqual(file, 'custom-name-1.json'); helper.validate(absolutePath); @@ -61,7 +61,7 @@ function validate() { // Test with file and error arguments. const file = process.report.writeReport('custom-name-2.json', new Error('test error')); - const absolutePath = path.join(tmpdir.path, file); + const absolutePath = tmpdir.resolve(file); assert.strictEqual(helper.findReports(process.pid, tmpdir.path).length, 0); assert.strictEqual(file, 'custom-name-2.json'); helper.validate(absolutePath); @@ -117,7 +117,7 @@ function validate() { { // Test the case where the report file cannot be opened. - const reportDir = path.join(tmpdir.path, 'does', 'not', 'exist'); + const reportDir = tmpdir.resolve('does', 'not', 'exist'); const args = [`--report-directory=${reportDir}`, '-e', 'process.report.writeReport()']; diff --git a/test/sequential/test-cpu-prof-dir-absolute.js b/test/sequential/test-cpu-prof-dir-absolute.js index ad0842dbc4c4fc..03d7f50865b650 100644 --- a/test/sequential/test-cpu-prof-dir-absolute.js +++ b/test/sequential/test-cpu-prof-dir-absolute.js @@ -8,7 +8,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'); @@ -22,7 +21,7 @@ const { // relative --cpu-prof-dir { tmpdir.refresh(); - const dir = path.join(tmpdir.path, 'prof'); + const dir = tmpdir.resolve('prof'); const output = spawnSync(process.execPath, [ '--cpu-prof', '--cpu-prof-interval', diff --git a/test/sequential/test-cpu-prof-dir-and-name.js b/test/sequential/test-cpu-prof-dir-and-name.js index 7ce775ebc16973..84af5d8212065d 100644 --- a/test/sequential/test-cpu-prof-dir-and-name.js +++ b/test/sequential/test-cpu-prof-dir-and-name.js @@ -21,7 +21,7 @@ const { { tmpdir.refresh(); - const dir = path.join(tmpdir.path, 'prof'); + const dir = tmpdir.resolve('prof'); const file = path.join(dir, 'test.cpuprofile'); const output = spawnSync(process.execPath, [ '--cpu-prof', diff --git a/test/sequential/test-cpu-prof-dir-relative.js b/test/sequential/test-cpu-prof-dir-relative.js index 2d679959efdebd..ac8c46486feae5 100644 --- a/test/sequential/test-cpu-prof-dir-relative.js +++ b/test/sequential/test-cpu-prof-dir-relative.js @@ -8,7 +8,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'); @@ -37,7 +36,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 = getCpuProfiles(dir); assert.strictEqual(profiles.length, 1); diff --git a/test/sequential/test-cpu-prof-dir-worker.js b/test/sequential/test-cpu-prof-dir-worker.js index fe72af7416d813..22c7f79deb2fca 100644 --- a/test/sequential/test-cpu-prof-dir-worker.js +++ b/test/sequential/test-cpu-prof-dir-worker.js @@ -8,7 +8,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'); @@ -37,7 +36,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 = getCpuProfiles(dir); assert.strictEqual(profiles.length, 2); diff --git a/test/sequential/test-cpu-prof-name.js b/test/sequential/test-cpu-prof-name.js index 58d9a0ec15862f..3f1c6945c5436f 100644 --- a/test/sequential/test-cpu-prof-name.js +++ b/test/sequential/test-cpu-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 { // --cpu-prof-name { tmpdir.refresh(); - const file = path.join(tmpdir.path, 'test.cpuprofile'); + const file = tmpdir.resolve('test.cpuprofile'); const output = spawnSync(process.execPath, [ '--cpu-prof', '--cpu-prof-interval', diff --git a/test/sequential/test-diagnostic-dir-cpu-prof.js b/test/sequential/test-diagnostic-dir-cpu-prof.js index 396a6ca7de0595..75f1d86ef4b2b5 100644 --- a/test/sequential/test-diagnostic-dir-cpu-prof.js +++ b/test/sequential/test-diagnostic-dir-cpu-prof.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 { { tmpdir.refresh(); - const dir = path.join(tmpdir.path, 'prof'); + const dir = tmpdir.resolve('prof'); const output = spawnSync(process.execPath, [ '--cpu-prof', '--cpu-prof-interval', @@ -50,8 +49,8 @@ const { { tmpdir.refresh(); - const dir = path.join(tmpdir.path, 'diag'); - const dir2 = path.join(tmpdir.path, 'prof'); + const dir = tmpdir.resolve('diag'); + const dir2 = tmpdir.resolve('prof'); const output = spawnSync(process.execPath, [ '--cpu-prof', '--cpu-prof-interval', diff --git a/test/sequential/test-diagnostic-dir-heap-prof.js b/test/sequential/test-diagnostic-dir-heap-prof.js index 0ec68ab49efdf7..c74c075724185d 100644 --- a/test/sequential/test-diagnostic-dir-heap-prof.js +++ b/test/sequential/test-diagnostic-dir-heap-prof.js @@ -66,7 +66,7 @@ function getHeapProfiles(dir) { // Test --diagnostic-dir changes the default for --cpu-prof { tmpdir.refresh(); - const dir = path.join(tmpdir.path, 'prof'); + const dir = tmpdir.resolve('prof'); const output = spawnSync(process.execPath, [ '--heap-prof', '--diagnostic-dir', @@ -91,8 +91,8 @@ function getHeapProfiles(dir) { // Test --heap-prof-dir overwrites --diagnostic-dir { tmpdir.refresh(); - const dir = path.join(tmpdir.path, 'diag'); - const dir2 = path.join(tmpdir.path, 'prof'); + const dir = tmpdir.resolve('diag'); + const dir2 = tmpdir.resolve('prof'); const output = spawnSync(process.execPath, [ '--heap-prof', '--heap-prof-interval', diff --git a/test/sequential/test-http2-timeout-large-write-file.js b/test/sequential/test-http2-timeout-large-write-file.js index 520958bd57f6d4..a35268b6127bae 100644 --- a/test/sequential/test-http2-timeout-large-write-file.js +++ b/test/sequential/test-http2-timeout-large-write-file.js @@ -6,7 +6,6 @@ const assert = require('assert'); const fixtures = require('../common/fixtures'); const fs = require('fs'); const http2 = require('http2'); -const path = require('path'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); @@ -30,7 +29,7 @@ let offsetTimeout = common.platformTimeout(100); let didReceiveData = false; const content = Buffer.alloc(writeSize, 0x44); -const filepath = path.join(tmpdir.path, 'http2-large-write.tmp'); +const filepath = tmpdir.resolve('http2-large-write.tmp'); fs.writeFileSync(filepath, content, 'binary'); const fd = fs.openSync(filepath, 'r'); process.on('beforeExit', () => fs.closeSync(fd)); diff --git a/test/sequential/test-single-executable-application-disable-experimental-sea-warning.js b/test/sequential/test-single-executable-application-disable-experimental-sea-warning.js index a20dce83988228..0b4701b07e1c54 100644 --- a/test/sequential/test-single-executable-application-disable-experimental-sea-warning.js +++ b/test/sequential/test-single-executable-application-disable-experimental-sea-warning.js @@ -21,10 +21,10 @@ const { strictEqual } = require('assert'); const assert = require('assert'); const inputFile = fixtures.path('sea.js'); -const requirableFile = join(tmpdir.path, 'requirable.js'); -const configFile = join(tmpdir.path, 'sea-config.json'); -const seaPrepBlob = join(tmpdir.path, 'sea-prep.blob'); -const outputFile = join(tmpdir.path, process.platform === 'win32' ? 'sea.exe' : 'sea'); +const requirableFile = tmpdir.resolve('requirable.js'); +const configFile = tmpdir.resolve('sea-config.json'); +const seaPrepBlob = tmpdir.resolve('sea-prep.blob'); +const outputFile = tmpdir.resolve(process.platform === 'win32' ? 'sea.exe' : 'sea'); tmpdir.refresh(); @@ -43,7 +43,7 @@ writeFileSync(configFile, ` `); // Copy input to working directory -copyFileSync(inputFile, join(tmpdir.path, 'sea.js')); +copyFileSync(inputFile, tmpdir.resolve('sea.js')); execFileSync(process.execPath, ['--experimental-sea-config', 'sea-config.json'], { cwd: tmpdir.path }); diff --git a/test/sequential/test-single-executable-application-empty.js b/test/sequential/test-single-executable-application-empty.js index 961ae0018368cf..13dc2e834b7caa 100644 --- a/test/sequential/test-single-executable-application-empty.js +++ b/test/sequential/test-single-executable-application-empty.js @@ -15,16 +15,15 @@ skipIfSingleExecutableIsNotSupported(); const tmpdir = require('../common/tmpdir'); const { copyFileSync, writeFileSync, existsSync } = require('fs'); const { execFileSync } = require('child_process'); -const { join } = require('path'); const assert = require('assert'); -const configFile = join(tmpdir.path, 'sea-config.json'); -const seaPrepBlob = join(tmpdir.path, 'sea-prep.blob'); -const outputFile = join(tmpdir.path, process.platform === 'win32' ? 'sea.exe' : 'sea'); +const configFile = tmpdir.resolve('sea-config.json'); +const seaPrepBlob = tmpdir.resolve('sea-prep.blob'); +const outputFile = tmpdir.resolve(process.platform === 'win32' ? 'sea.exe' : 'sea'); tmpdir.refresh(); -writeFileSync(join(tmpdir.path, 'empty.js'), '', 'utf-8'); +writeFileSync(tmpdir.resolve('empty.js'), '', 'utf-8'); writeFileSync(configFile, ` { "main": "empty.js", diff --git a/test/sequential/test-single-executable-application-snapshot.js b/test/sequential/test-single-executable-application-snapshot.js index d1c44b6dbab3b7..51b09cea662adf 100644 --- a/test/sequential/test-single-executable-application-snapshot.js +++ b/test/sequential/test-single-executable-application-snapshot.js @@ -14,17 +14,16 @@ skipIfSingleExecutableIsNotSupported(); const tmpdir = require('../common/tmpdir'); const { copyFileSync, writeFileSync, existsSync } = require('fs'); const { spawnSync } = require('child_process'); -const { join } = require('path'); const assert = require('assert'); -const configFile = join(tmpdir.path, 'sea-config.json'); -const seaPrepBlob = join(tmpdir.path, 'sea-prep.blob'); -const outputFile = join(tmpdir.path, process.platform === 'win32' ? 'sea.exe' : 'sea'); +const configFile = tmpdir.resolve('sea-config.json'); +const seaPrepBlob = tmpdir.resolve('sea-prep.blob'); +const outputFile = tmpdir.resolve(process.platform === 'win32' ? 'sea.exe' : 'sea'); { tmpdir.refresh(); - writeFileSync(join(tmpdir.path, 'snapshot.js'), '', 'utf-8'); + writeFileSync(tmpdir.resolve('snapshot.js'), '', 'utf-8'); writeFileSync(configFile, ` { "main": "snapshot.js", @@ -57,7 +56,7 @@ const outputFile = join(tmpdir.path, process.platform === 'win32' ? 'sea.exe' : }); `; - writeFileSync(join(tmpdir.path, 'snapshot.js'), code, 'utf-8'); + writeFileSync(tmpdir.resolve('snapshot.js'), code, 'utf-8'); writeFileSync(configFile, ` { "main": "snapshot.js", diff --git a/test/sequential/test-single-executable-application-use-code-cache.js b/test/sequential/test-single-executable-application-use-code-cache.js index 6d45fcf289a772..96de5769b1fe6b 100644 --- a/test/sequential/test-single-executable-application-use-code-cache.js +++ b/test/sequential/test-single-executable-application-use-code-cache.js @@ -21,10 +21,10 @@ const { strictEqual } = require('assert'); const assert = require('assert'); const inputFile = fixtures.path('sea.js'); -const requirableFile = join(tmpdir.path, 'requirable.js'); -const configFile = join(tmpdir.path, 'sea-config.json'); -const seaPrepBlob = join(tmpdir.path, 'sea-prep.blob'); -const outputFile = join(tmpdir.path, process.platform === 'win32' ? 'sea.exe' : 'sea'); +const requirableFile = tmpdir.resolve('requirable.js'); +const configFile = tmpdir.resolve('sea-config.json'); +const seaPrepBlob = tmpdir.resolve('sea-prep.blob'); +const outputFile = tmpdir.resolve(process.platform === 'win32' ? 'sea.exe' : 'sea'); tmpdir.refresh(); @@ -43,7 +43,7 @@ writeFileSync(configFile, ` `); // Copy input to working directory -copyFileSync(inputFile, join(tmpdir.path, 'sea.js')); +copyFileSync(inputFile, tmpdir.resolve('sea.js')); execFileSync(process.execPath, ['--experimental-sea-config', 'sea-config.json'], { cwd: tmpdir.path }); diff --git a/test/sequential/test-single-executable-application.js b/test/sequential/test-single-executable-application.js index 99d0c0d6e352dc..e930254cb0a7ae 100644 --- a/test/sequential/test-single-executable-application.js +++ b/test/sequential/test-single-executable-application.js @@ -20,10 +20,10 @@ const { strictEqual } = require('assert'); const assert = require('assert'); const inputFile = fixtures.path('sea.js'); -const requirableFile = join(tmpdir.path, 'requirable.js'); -const configFile = join(tmpdir.path, 'sea-config.json'); -const seaPrepBlob = join(tmpdir.path, 'sea-prep.blob'); -const outputFile = join(tmpdir.path, process.platform === 'win32' ? 'sea.exe' : 'sea'); +const requirableFile = tmpdir.resolve('requirable.js'); +const configFile = tmpdir.resolve('sea-config.json'); +const seaPrepBlob = tmpdir.resolve('sea-prep.blob'); +const outputFile = tmpdir.resolve(process.platform === 'win32' ? 'sea.exe' : 'sea'); tmpdir.refresh(); @@ -42,7 +42,7 @@ writeFileSync(configFile, ` `); // Copy input to working directory -copyFileSync(inputFile, join(tmpdir.path, 'sea.js')); +copyFileSync(inputFile, tmpdir.resolve('sea.js')); execFileSync(process.execPath, ['--experimental-sea-config', 'sea-config.json'], { cwd: tmpdir.path }); diff --git a/test/sequential/test-tls-session-timeout.js b/test/sequential/test-tls-session-timeout.js index 86a29eed46fe73..f0ec612b449867 100644 --- a/test/sequential/test-tls-session-timeout.js +++ b/test/sequential/test-tls-session-timeout.js @@ -45,7 +45,6 @@ function doTest() { const assert = require('assert'); const tls = require('tls'); const fs = require('fs'); - const join = require('path').join; const fixtures = require('../common/fixtures'); const spawn = require('child_process').spawn; @@ -69,7 +68,7 @@ function doTest() { const sessionFileName = (function() { const ticketFileName = 'tls-session-ticket.txt'; - const tmpPath = join(tmpdir.path, ticketFileName); + const tmpPath = tmpdir.resolve(ticketFileName); fs.writeFileSync(tmpPath, fixtures.readSync(ticketFileName)); return tmpPath; }()); diff --git a/test/sequential/test-watch-mode.mjs b/test/sequential/test-watch-mode.mjs index 38654a78a1dc7f..dbe486f5bb2991 100644 --- a/test/sequential/test-watch-mode.mjs +++ b/test/sequential/test-watch-mode.mjs @@ -117,7 +117,7 @@ describe('watch mode', { concurrency: true, timeout: 60_000 }, () => { it('should watch changes to a file with watch-path', { skip: !supportsRecursive, }, async () => { - const dir = path.join(tmpdir.path, 'subdir1'); + const dir = tmpdir.resolve('subdir1'); mkdirSync(dir); const file = createTmpFile(); const watchedFile = createTmpFile('', '.js', dir); @@ -138,7 +138,7 @@ describe('watch mode', { concurrency: true, timeout: 60_000 }, () => { it('should watch when running an non-existing file - when specified under --watch-path', { skip: !supportsRecursive }, async () => { - const dir = path.join(tmpdir.path, 'subdir2'); + const dir = tmpdir.resolve('subdir2'); mkdirSync(dir); const file = path.join(dir, 'non-existing.js'); const watchedFile = createTmpFile('', '.js', dir); @@ -156,7 +156,7 @@ describe('watch mode', { concurrency: true, timeout: 60_000 }, () => { it('should watch when running an non-existing file - when specified under --watch-path with equals', { skip: !supportsRecursive }, async () => { - const dir = path.join(tmpdir.path, 'subdir3'); + const dir = tmpdir.resolve('subdir3'); mkdirSync(dir); const file = path.join(dir, 'non-existing.js'); const watchedFile = createTmpFile('', '.js', dir); @@ -295,21 +295,21 @@ console.log(values.random); it('should not watch when running an missing file', { skip: !supportsRecursive }, async () => { - const nonExistingfile = path.join(tmpdir.path, `${tmpFiles++}.js`); + const nonExistingfile = tmpdir.resolve(`${tmpFiles++}.js`); await failWriteSucceed({ file: nonExistingfile, watchedFile: nonExistingfile }); }); it('should not watch when running an missing mjs file', { skip: !supportsRecursive }, async () => { - const nonExistingfile = path.join(tmpdir.path, `${tmpFiles++}.mjs`); + const nonExistingfile = tmpdir.resolve(`${tmpFiles++}.mjs`); await failWriteSucceed({ file: nonExistingfile, watchedFile: nonExistingfile }); }); it('should watch changes to previously missing dependency', { skip: !supportsRecursive }, async () => { - const dependency = path.join(tmpdir.path, `${tmpFiles++}.js`); + const dependency = tmpdir.resolve(`${tmpFiles++}.js`); const relativeDependencyPath = `./${path.basename(dependency)}`; const dependant = createTmpFile(`console.log(require('${relativeDependencyPath}'))`); @@ -320,7 +320,7 @@ console.log(values.random); skip: !supportsRecursive }, async () => { const relativeDependencyPath = `./${tmpFiles++}.mjs`; - const dependency = path.join(tmpdir.path, relativeDependencyPath); + const dependency = tmpdir.resolve(relativeDependencyPath); const dependant = createTmpFile(`import ${JSON.stringify(relativeDependencyPath)}`, '.mjs'); await failWriteSucceed({ file: dependant, watchedFile: dependency }); diff --git a/test/sequential/test-worker-prof.js b/test/sequential/test-worker-prof.js index c2df47a8e8a121..bcb5a477497d73 100644 --- a/test/sequential/test-worker-prof.js +++ b/test/sequential/test-worker-prof.js @@ -4,7 +4,6 @@ const tmpdir = require('../common/tmpdir'); const fs = require('fs'); const assert = require('assert'); const util = require('util'); -const { join } = require('path'); const { spawnSync } = require('child_process'); // Test that --prof also tracks Worker threads. @@ -67,7 +66,7 @@ if (process.argv[2] === 'child') { for (const logfile of logfiles) { const lines = fs.readFileSync( - join(tmpdir.path, logfile), 'utf8').split('\n'); + tmpdir.resolve(logfile), 'utf8').split('\n'); const ticks = lines.filter((line) => /^tick,/.test(line)).length; // Test that at least 15 ticks have been recorded for both parent and child diff --git a/test/tick-processor/test-tick-processor-polyfill-brokenfile.js b/test/tick-processor/test-tick-processor-polyfill-brokenfile.js index 2089325dff3e99..ac3cb8692b0215 100644 --- a/test/tick-processor/test-tick-processor-polyfill-brokenfile.js +++ b/test/tick-processor/test-tick-processor-polyfill-brokenfile.js @@ -15,10 +15,9 @@ if (isCPPSymbolsNotMapped) { const assert = require('assert'); const { spawn, spawnSync } = require('child_process'); -const path = require('path'); const { writeFileSync } = require('fs'); -const LOG_FILE = path.join(tmpdir.path, 'tick-processor.log'); +const LOG_FILE = tmpdir.resolve('tick-processor.log'); const RETRY_TIMEOUT = 150; const BROKEN_PART = 'tick,'; const WARN_REG_EXP = /\(node:\d+\) \[BROKEN_PROFILE_FILE] Warning: Profile file .* is broken/; diff --git a/test/tick-processor/tick-processor-base.js b/test/tick-processor/tick-processor-base.js index 91307d16928889..a9fd939495091b 100644 --- a/test/tick-processor/tick-processor-base.js +++ b/test/tick-processor/tick-processor-base.js @@ -2,12 +2,11 @@ require('../common'); const fs = require('fs'); const cp = require('child_process'); -const path = require('path'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const LOG_FILE = path.join(tmpdir.path, 'tick-processor.log'); +const LOG_FILE = tmpdir.resolve('tick-processor.log'); const RETRY_TIMEOUT = 150; function runTest(test) { diff --git a/test/wasi/test-wasi-stdio.js b/test/wasi/test-wasi-stdio.js index 29e91281553817..d4c65f238df890 100644 --- a/test/wasi/test-wasi-stdio.js +++ b/test/wasi/test-wasi-stdio.js @@ -7,9 +7,9 @@ const { join } = require('path'); const { WASI } = require('wasi'); const modulePath = join(__dirname, 'wasm', 'stdin.wasm'); const buffer = readFileSync(modulePath); -const stdinFile = join(tmpdir.path, 'stdin.txt'); -const stdoutFile = join(tmpdir.path, 'stdout.txt'); -const stderrFile = join(tmpdir.path, 'stderr.txt'); +const stdinFile = tmpdir.resolve('stdin.txt'); +const stdoutFile = tmpdir.resolve('stdout.txt'); +const stderrFile = tmpdir.resolve('stderr.txt'); tmpdir.refresh(); // Write 33 x's. The test's buffer only holds 31 x's + a terminator. diff --git a/test/wasi/test-wasi-symlinks.js b/test/wasi/test-wasi-symlinks.js index 79369fd4c18247..9c95a0e55757d0 100644 --- a/test/wasi/test-wasi-symlinks.js +++ b/test/wasi/test-wasi-symlinks.js @@ -38,15 +38,15 @@ if (process.argv[2] === 'wasi-child') { // Setup the sandbox environment. tmpdir.refresh(); - const sandbox = path.join(tmpdir.path, 'sandbox'); + const sandbox = tmpdir.resolve('sandbox'); const sandboxedFile = path.join(sandbox, 'input.txt'); - const externalFile = path.join(tmpdir.path, 'outside.txt'); + const externalFile = tmpdir.resolve('outside.txt'); const sandboxedDir = path.join(sandbox, 'subdir'); const sandboxedSymlink = path.join(sandboxedDir, 'input_link.txt'); const escapingSymlink = path.join(sandboxedDir, 'outside.txt'); const loopSymlink1 = path.join(sandboxedDir, 'loop1'); const loopSymlink2 = path.join(sandboxedDir, 'loop2'); - const sandboxedTmp = path.join(tmpdir.path, 'tmp'); + const sandboxedTmp = tmpdir.resolve('tmp'); fs.mkdirSync(sandbox); fs.mkdirSync(sandboxedDir);