From 7daaa9b93aeefd6d48a16f3951b3b81fb409e93d Mon Sep 17 00:00:00 2001 From: Livia Medeiros Date: Tue, 15 Aug 2023 22:45:34 +0900 Subject: [PATCH] test: use `tmpdir.resolve()` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subsystems: blob, child_process, common, crypto, http, http2, readline, repl, snapshot, trace_events PR-URL: https://github.com/nodejs/node/pull/49127 Reviewed-By: Michaƫl Zasso Reviewed-By: Debadree Chatterjee --- test/parallel/test-blob-file-backed.js | 7 +++---- test/parallel/test-child-process-fork-exec-path.js | 3 +-- test/parallel/test-child-process-pipe-dataflow.js | 3 +-- test/parallel/test-crypto-authenticated-stream.js | 3 +-- test/parallel/test-crypto-sign-verify.js | 5 ++--- test/parallel/test-http-agent-getname.js | 3 +-- test/parallel/test-http-chunk-problem.js | 2 +- test/parallel/test-http-pipe-fs.js | 3 +-- test/parallel/test-http2-compat-serverrequest-pipe.js | 3 +-- test/parallel/test-http2-pipe-named-pipe.js | 3 +-- test/parallel/test-http2-pipe.js | 3 +-- .../test-http2-respond-file-error-pipe-offset.js | 3 +-- test/parallel/test-http2-respond-file-with-pipe.js | 3 +-- test/parallel/test-readline-async-iterators-destroy.js | 3 +-- test/parallel/test-readline-async-iterators.js | 3 +-- test/parallel/test-repl-autocomplete.js | 3 +-- test/parallel/test-repl-history-navigation.js | 3 +-- test/parallel/test-repl-history-perm.js | 3 +-- test/parallel/test-repl-persistent-history.js | 8 +++----- test/parallel/test-repl-programmatic-history.js | 8 +++----- test/parallel/test-repl-require-after-write.js | 3 +-- test/parallel/test-repl-reverse-search.js | 3 +-- test/parallel/test-repl-save-load.js | 7 +++---- test/parallel/test-snapshot-api.js | 9 ++++----- test/parallel/test-snapshot-argv1.js | 7 +++---- test/parallel/test-snapshot-basic.js | 5 ++--- test/parallel/test-snapshot-cjs-main.js | 3 +-- test/parallel/test-snapshot-console.js | 5 ++--- test/parallel/test-snapshot-error.js | 9 ++++----- test/parallel/test-snapshot-eval.js | 3 +-- test/parallel/test-snapshot-gzip.js | 5 ++--- test/parallel/test-snapshot-incompatible.js | 5 ++--- test/parallel/test-snapshot-namespaced-builtin.js | 7 +++---- test/parallel/test-snapshot-net.js | 5 ++--- test/parallel/test-snapshot-typescript.js | 9 ++++----- test/parallel/test-snapshot-umd.js | 7 +++---- test/parallel/test-snapshot-warning.js | 7 +++---- test/parallel/test-snapshot-weak-reference.js | 5 ++--- test/parallel/test-snapshot-worker.js | 3 +-- test/parallel/test-trace-events-all.js | 3 +-- test/parallel/test-trace-events-api.js | 3 +-- test/parallel/test-trace-events-async-hooks-dynamic.js | 3 +-- test/parallel/test-trace-events-async-hooks-worker.js | 3 +-- test/parallel/test-trace-events-async-hooks.js | 3 +-- test/parallel/test-trace-events-binding.js | 3 +-- test/parallel/test-trace-events-bootstrap.js | 3 +-- test/parallel/test-trace-events-console.js | 3 +-- test/parallel/test-trace-events-environment.js | 3 +-- test/parallel/test-trace-events-file-pattern.js | 4 +--- test/parallel/test-trace-events-fs-async.js | 3 +-- test/parallel/test-trace-events-fs-sync.js | 3 +-- test/parallel/test-trace-events-http.js | 3 +-- test/parallel/test-trace-events-metadata.js | 3 +-- test/parallel/test-trace-events-net.js | 3 +-- test/parallel/test-trace-events-none.js | 3 +-- test/parallel/test-trace-events-process-exit.js | 3 +-- test/parallel/test-trace-events-promises.js | 3 +-- test/parallel/test-trace-events-threadpool.js | 3 +-- test/parallel/test-trace-events-v8.js | 3 +-- test/parallel/test-trace-events-vm.js | 3 +-- 60 files changed, 92 insertions(+), 154 deletions(-) diff --git a/test/parallel/test-blob-file-backed.js b/test/parallel/test-blob-file-backed.js index acf04a44386b6a..0532bda07b6e80 100644 --- a/test/parallel/test-blob-file-backed.js +++ b/test/parallel/test-blob-file-backed.js @@ -15,13 +15,12 @@ const { const { unlink } = require('fs/promises'); -const path = require('path'); const { Blob } = require('buffer'); const tmpdir = require('../common/tmpdir'); -const testfile = path.join(tmpdir.path, 'test-file-backed-blob.txt'); -const testfile2 = path.join(tmpdir.path, 'test-file-backed-blob2.txt'); -const testfile3 = path.join(tmpdir.path, 'test-file-backed-blob3.txt'); +const testfile = tmpdir.resolve('test-file-backed-blob.txt'); +const testfile2 = tmpdir.resolve('test-file-backed-blob2.txt'); +const testfile3 = tmpdir.resolve('test-file-backed-blob3.txt'); tmpdir.refresh(); const data = `${'a'.repeat(1000)}${'b'.repeat(2000)}`; diff --git a/test/parallel/test-child-process-fork-exec-path.js b/test/parallel/test-child-process-fork-exec-path.js index 38adfd72de4298..3417a102c69943 100644 --- a/test/parallel/test-child-process-fork-exec-path.js +++ b/test/parallel/test-child-process-fork-exec-path.js @@ -27,13 +27,12 @@ const common = require('../common'); const tmpdir = require('../common/tmpdir'); const { addLibraryPath } = require('../common/shared-lib-util'); const assert = require('assert'); -const path = require('path'); const fs = require('fs'); const { fork } = require('child_process'); const msg = { test: 'this' }; const nodePath = process.execPath; -const copyPath = path.join(tmpdir.path, 'node-copy.exe'); +const copyPath = tmpdir.resolve('node-copy.exe'); addLibraryPath(process.env); diff --git a/test/parallel/test-child-process-pipe-dataflow.js b/test/parallel/test-child-process-pipe-dataflow.js index e989ff135c8047..257f4046aa6b99 100644 --- a/test/parallel/test-child-process-pipe-dataflow.js +++ b/test/parallel/test-child-process-pipe-dataflow.js @@ -1,7 +1,6 @@ 'use strict'; const common = require('../common'); const assert = require('assert'); -const path = require('path'); const fs = require('fs'); const spawn = require('child_process').spawn; const tmpdir = require('../common/tmpdir'); @@ -18,7 +17,7 @@ const MB = KB * KB; { tmpdir.refresh(); - const file = path.resolve(tmpdir.path, 'data.txt'); + const file = tmpdir.resolve('data.txt'); const buf = Buffer.alloc(MB).fill('x'); // Most OS commands that deal with data, attach special meanings to new line - diff --git a/test/parallel/test-crypto-authenticated-stream.js b/test/parallel/test-crypto-authenticated-stream.js index f29ee8932af804..fcd53aa4696abc 100644 --- a/test/parallel/test-crypto-authenticated-stream.js +++ b/test/parallel/test-crypto-authenticated-stream.js @@ -7,7 +7,6 @@ if (!common.hasCrypto) const assert = require('assert'); const crypto = require('crypto'); const fs = require('fs'); -const path = require('path'); const stream = require('stream'); const tmpdir = require('../common/tmpdir'); @@ -72,7 +71,7 @@ function mstream(config) { function fstream(config) { const count = fstream.count++; - const filename = (name) => path.join(tmpdir.path, `${name}${count}`); + const filename = (name) => tmpdir.resolve(`${name}${count}`); const { cipher, key, iv, aad, authTagLength, plaintextLength } = config; const expected = Buffer.alloc(plaintextLength); diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js index 74c0ff53eb18b7..b39ec22dceb5b7 100644 --- a/test/parallel/test-crypto-sign-verify.js +++ b/test/parallel/test-crypto-sign-verify.js @@ -5,7 +5,6 @@ if (!common.hasCrypto) const assert = require('assert'); const fs = require('fs'); -const path = require('path'); const exec = require('child_process').exec; const crypto = require('crypto'); const fixtures = require('../common/fixtures'); @@ -617,9 +616,9 @@ assert.throws( const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); - const sigfile = path.join(tmpdir.path, 's5.sig'); + const sigfile = tmpdir.resolve('s5.sig'); fs.writeFileSync(sigfile, s5); - const msgfile = path.join(tmpdir.path, 's5.msg'); + const msgfile = tmpdir.resolve('s5.msg'); fs.writeFileSync(msgfile, msg); const cmd = diff --git a/test/parallel/test-http-agent-getname.js b/test/parallel/test-http-agent-getname.js index 14cfcfaabdf6f4..7153899ac58dbb 100644 --- a/test/parallel/test-http-agent-getname.js +++ b/test/parallel/test-http-agent-getname.js @@ -3,7 +3,6 @@ require('../common'); const assert = require('assert'); const http = require('http'); -const path = require('path'); const tmpdir = require('../common/tmpdir'); @@ -41,7 +40,7 @@ assert.strictEqual( ); // unix socket -const socketPath = path.join(tmpdir.path, 'foo', 'bar'); +const socketPath = tmpdir.resolve('foo', 'bar'); assert.strictEqual( agent.getName({ socketPath diff --git a/test/parallel/test-http-chunk-problem.js b/test/parallel/test-http-chunk-problem.js index ebfd940687947e..a3c354aecde468 100644 --- a/test/parallel/test-http-chunk-problem.js +++ b/test/parallel/test-http-chunk-problem.js @@ -39,7 +39,7 @@ const cp = require('child_process'); const tmpdir = require('../common/tmpdir'); -const filename = require('path').join(tmpdir.path, 'big'); +const filename = tmpdir.resolve('big'); let server; function executeRequest(cb) { diff --git a/test/parallel/test-http-pipe-fs.js b/test/parallel/test-http-pipe-fs.js index dfb44ff3b25d99..b7c1a029188ea3 100644 --- a/test/parallel/test-http-pipe-fs.js +++ b/test/parallel/test-http-pipe-fs.js @@ -23,7 +23,6 @@ const common = require('../common'); const http = require('http'); const fs = require('fs'); -const path = require('path'); const Countdown = require('../common/countdown'); const NUMBER_OF_STREAMS = 2; @@ -32,7 +31,7 @@ const countdown = new Countdown(NUMBER_OF_STREAMS, () => server.close()); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const file = path.join(tmpdir.path, 'http-pipe-fs-test.txt'); +const file = tmpdir.resolve('http-pipe-fs-test.txt'); const server = http.createServer(common.mustCall(function(req, res) { const stream = fs.createWriteStream(file); diff --git a/test/parallel/test-http2-compat-serverrequest-pipe.js b/test/parallel/test-http2-compat-serverrequest-pipe.js index a02a64cdc0d1b8..64beb6472b9736 100644 --- a/test/parallel/test-http2-compat-serverrequest-pipe.js +++ b/test/parallel/test-http2-compat-serverrequest-pipe.js @@ -7,14 +7,13 @@ const fixtures = require('../common/fixtures'); const assert = require('assert'); const http2 = require('http2'); const fs = require('fs'); -const path = require('path'); // Piping should work as expected with createWriteStream const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); const loc = fixtures.path('person-large.jpg'); -const fn = path.join(tmpdir.path, 'http2-url-tests.js'); +const fn = tmpdir.resolve('http2-url-tests.js'); const server = http2.createServer(); diff --git a/test/parallel/test-http2-pipe-named-pipe.js b/test/parallel/test-http2-pipe-named-pipe.js index 0ef05da1935d8c..eb9b1b568c188d 100644 --- a/test/parallel/test-http2-pipe-named-pipe.js +++ b/test/parallel/test-http2-pipe-named-pipe.js @@ -8,14 +8,13 @@ const assert = require('assert'); const http2 = require('http2'); const fs = require('fs'); const net = require('net'); -const path = require('path'); // HTTP/2 servers can listen on a named pipe. const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); const loc = fixtures.path('person-large.jpg'); -const fn = path.join(tmpdir.path, 'person-large.jpg'); +const fn = tmpdir.resolve('person-large.jpg'); const server = http2.createServer(); diff --git a/test/parallel/test-http2-pipe.js b/test/parallel/test-http2-pipe.js index e081c6d6d7a5de..ebd89e23d8e98a 100644 --- a/test/parallel/test-http2-pipe.js +++ b/test/parallel/test-http2-pipe.js @@ -7,14 +7,13 @@ const fixtures = require('../common/fixtures'); const assert = require('assert'); const http2 = require('http2'); const fs = require('fs'); -const path = require('path'); // Piping should work as expected with createWriteStream const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); const loc = fixtures.path('person-large.jpg'); -const fn = path.join(tmpdir.path, 'http2-url-tests.js'); +const fn = tmpdir.resolve('http2-url-tests.js'); const server = http2.createServer(); diff --git a/test/parallel/test-http2-respond-file-error-pipe-offset.js b/test/parallel/test-http2-respond-file-error-pipe-offset.js index 39876baaf51dab..bd043e42f4a62e 100644 --- a/test/parallel/test-http2-respond-file-error-pipe-offset.js +++ b/test/parallel/test-http2-respond-file-error-pipe-offset.js @@ -6,7 +6,6 @@ if (!common.hasCrypto) if (common.isWindows) common.skip('no mkfifo on Windows'); const child_process = require('child_process'); -const path = require('path'); const fs = require('fs'); const http2 = require('http2'); const assert = require('assert'); @@ -14,7 +13,7 @@ const assert = require('assert'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const pipeName = path.join(tmpdir.path, 'pipe'); +const pipeName = tmpdir.resolve('pipe'); const mkfifo = child_process.spawnSync('mkfifo', [ pipeName ]); if (mkfifo.error && mkfifo.error.code === 'ENOENT') { diff --git a/test/parallel/test-http2-respond-file-with-pipe.js b/test/parallel/test-http2-respond-file-with-pipe.js index 30bcce46b9d232..14f164881c215d 100644 --- a/test/parallel/test-http2-respond-file-with-pipe.js +++ b/test/parallel/test-http2-respond-file-with-pipe.js @@ -6,7 +6,6 @@ if (!common.hasCrypto) if (common.isWindows) common.skip('no mkfifo on Windows'); const child_process = require('child_process'); -const path = require('path'); const fs = require('fs'); const http2 = require('http2'); const assert = require('assert'); @@ -14,7 +13,7 @@ const assert = require('assert'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const pipeName = path.join(tmpdir.path, 'pipe'); +const pipeName = tmpdir.resolve('pipe'); const mkfifo = child_process.spawnSync('mkfifo', [ pipeName ]); if (mkfifo.error && mkfifo.error.code === 'ENOENT') { diff --git a/test/parallel/test-readline-async-iterators-destroy.js b/test/parallel/test-readline-async-iterators-destroy.js index 8641b0a2acde75..0a3fb018906bf0 100644 --- a/test/parallel/test-readline-async-iterators-destroy.js +++ b/test/parallel/test-readline-async-iterators-destroy.js @@ -3,14 +3,13 @@ const common = require('../common'); const fs = require('fs'); const { once } = require('events'); -const { join } = require('path'); const readline = require('readline'); const assert = require('assert'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const filename = join(tmpdir.path, 'test.txt'); +const filename = tmpdir.resolve('test.txt'); const testContents = [ '', diff --git a/test/parallel/test-readline-async-iterators.js b/test/parallel/test-readline-async-iterators.js index 57c74f69d587d8..fdd3edaaf9e119 100644 --- a/test/parallel/test-readline-async-iterators.js +++ b/test/parallel/test-readline-async-iterators.js @@ -2,7 +2,6 @@ const common = require('../common'); const fs = require('fs'); -const { join } = require('path'); const readline = require('readline'); const { Readable } = require('stream'); const assert = require('assert'); @@ -10,7 +9,7 @@ const assert = require('assert'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const filename = join(tmpdir.path, 'test.txt'); +const filename = tmpdir.resolve('test.txt'); const testContents = [ '', diff --git a/test/parallel/test-repl-autocomplete.js b/test/parallel/test-repl-autocomplete.js index b107053183080a..cb17523494b2ff 100644 --- a/test/parallel/test-repl-autocomplete.js +++ b/test/parallel/test-repl-autocomplete.js @@ -7,7 +7,6 @@ const stream = require('stream'); const REPL = require('internal/repl'); const assert = require('assert'); const fs = require('fs'); -const path = require('path'); const { inspect } = require('util'); common.skipIfDumbTerminal(); @@ -17,7 +16,7 @@ tmpdir.refresh(); process.throwDeprecation = true; -const defaultHistoryPath = path.join(tmpdir.path, '.node_repl_history'); +const defaultHistoryPath = tmpdir.resolve('.node_repl_history'); // Create an input stream specialized for testing an array of actions class ActionStream extends stream.Stream { diff --git a/test/parallel/test-repl-history-navigation.js b/test/parallel/test-repl-history-navigation.js index a3826e547a27fe..64236ec734923d 100644 --- a/test/parallel/test-repl-history-navigation.js +++ b/test/parallel/test-repl-history-navigation.js @@ -7,7 +7,6 @@ const stream = require('stream'); const REPL = require('internal/repl'); const assert = require('assert'); const fs = require('fs'); -const path = require('path'); const { inspect } = require('util'); common.skipIfDumbTerminal(); @@ -18,7 +17,7 @@ tmpdir.refresh(); process.throwDeprecation = true; process.on('warning', common.mustNotCall()); -const defaultHistoryPath = path.join(tmpdir.path, '.node_repl_history'); +const defaultHistoryPath = tmpdir.resolve('.node_repl_history'); // Create an input stream specialized for testing an array of actions class ActionStream extends stream.Stream { diff --git a/test/parallel/test-repl-history-perm.js b/test/parallel/test-repl-history-perm.js index aeca832d430978..1f33c2faf55ace 100644 --- a/test/parallel/test-repl-history-perm.js +++ b/test/parallel/test-repl-history-perm.js @@ -13,7 +13,6 @@ if (common.isWindows) { } const assert = require('assert'); -const path = require('path'); const fs = require('fs'); const repl = require('internal/repl'); const Duplex = require('stream').Duplex; @@ -33,7 +32,7 @@ stream.readable = stream.writable = true; const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const replHistoryPath = path.join(tmpdir.path, '.node_repl_history'); +const replHistoryPath = tmpdir.resolve('.node_repl_history'); const checkResults = common.mustSucceed((r) => { const stat = fs.statSync(replHistoryPath); diff --git a/test/parallel/test-repl-persistent-history.js b/test/parallel/test-repl-persistent-history.js index b0cddf0a2bd020..99ba92eda4cf3d 100644 --- a/test/parallel/test-repl-persistent-history.js +++ b/test/parallel/test-repl-persistent-history.js @@ -8,7 +8,6 @@ const stream = require('stream'); const REPL = require('internal/repl'); const assert = require('assert'); const fs = require('fs'); -const path = require('path'); const os = require('os'); const util = require('util'); @@ -60,12 +59,11 @@ const CLEAR = { ctrl: true, name: 'u' }; // File paths const historyFixturePath = fixtures.path('.node_repl_history'); -const historyPath = path.join(tmpdir.path, '.fixture_copy_repl_history'); +const historyPath = tmpdir.resolve('.fixture_copy_repl_history'); const historyPathFail = fixtures.path('nonexistent_folder', 'filename'); -const defaultHistoryPath = path.join(tmpdir.path, '.node_repl_history'); +const defaultHistoryPath = tmpdir.resolve('.node_repl_history'); const emptyHiddenHistoryPath = fixtures.path('.empty-hidden-repl-history-file'); -const devNullHistoryPath = path.join(tmpdir.path, - '.dev-null-repl-history-file'); +const devNullHistoryPath = tmpdir.resolve('.dev-null-repl-history-file'); // Common message bits const prompt = '> '; const replDisabled = '\nPersistent history support disabled. Set the ' + diff --git a/test/parallel/test-repl-programmatic-history.js b/test/parallel/test-repl-programmatic-history.js index e2ad2cc66fd44d..1ae5123c6c8ea1 100644 --- a/test/parallel/test-repl-programmatic-history.js +++ b/test/parallel/test-repl-programmatic-history.js @@ -6,7 +6,6 @@ const stream = require('stream'); const REPL = require('repl'); const assert = require('assert'); const fs = require('fs'); -const path = require('path'); const os = require('os'); const util = require('util'); @@ -58,12 +57,11 @@ const CLEAR = { ctrl: true, name: 'u' }; // File paths const historyFixturePath = fixtures.path('.node_repl_history'); -const historyPath = path.join(tmpdir.path, '.fixture_copy_repl_history'); +const historyPath = tmpdir.resolve('.fixture_copy_repl_history'); const historyPathFail = fixtures.path('nonexistent_folder', 'filename'); -const defaultHistoryPath = path.join(tmpdir.path, '.node_repl_history'); +const defaultHistoryPath = tmpdir.resolve('.node_repl_history'); const emptyHiddenHistoryPath = fixtures.path('.empty-hidden-repl-history-file'); -const devNullHistoryPath = path.join(tmpdir.path, - '.dev-null-repl-history-file'); +const devNullHistoryPath = tmpdir.resolve('.dev-null-repl-history-file'); // Common message bits const prompt = '> '; const replDisabled = '\nPersistent history support disabled. Set the ' + diff --git a/test/parallel/test-repl-require-after-write.js b/test/parallel/test-repl-require-after-write.js index 83c464473589e0..a374c57628f12a 100644 --- a/test/parallel/test-repl-require-after-write.js +++ b/test/parallel/test-repl-require-after-write.js @@ -4,11 +4,10 @@ const common = require('../common'); const tmpdir = require('../common/tmpdir'); const assert = require('assert'); const spawn = require('child_process').spawn; -const path = require('path'); tmpdir.refresh(); -const requirePath = JSON.stringify(path.join(tmpdir.path, 'non-existent.json')); +const requirePath = JSON.stringify(tmpdir.resolve('non-existent.json')); // Use -i to force node into interactive mode, despite stdout not being a TTY const child = spawn(process.execPath, ['-i']); diff --git a/test/parallel/test-repl-reverse-search.js b/test/parallel/test-repl-reverse-search.js index d92ac9221936c5..93fb037c392c01 100644 --- a/test/parallel/test-repl-reverse-search.js +++ b/test/parallel/test-repl-reverse-search.js @@ -7,7 +7,6 @@ const stream = require('stream'); const REPL = require('internal/repl'); const assert = require('assert'); const fs = require('fs'); -const path = require('path'); const { inspect } = require('util'); common.skipIfDumbTerminal(); @@ -16,7 +15,7 @@ common.allowGlobals('aaaa'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const defaultHistoryPath = path.join(tmpdir.path, '.node_repl_history'); +const defaultHistoryPath = tmpdir.resolve('.node_repl_history'); // Create an input stream specialized for testing an array of actions class ActionStream extends stream.Stream { diff --git a/test/parallel/test-repl-save-load.js b/test/parallel/test-repl-save-load.js index 7fe535f6431adf..19b4cf8f755407 100644 --- a/test/parallel/test-repl-save-load.js +++ b/test/parallel/test-repl-save-load.js @@ -23,7 +23,6 @@ const common = require('../common'); const ArrayStream = require('../common/arraystream'); const assert = require('assert'); -const join = require('path').join; const fs = require('fs'); const tmpdir = require('../common/tmpdir'); @@ -48,7 +47,7 @@ const testFile = [ ' return {one:1};', '})()', ]; -const saveFileName = join(tmpdir.path, 'test.save.js'); +const saveFileName = tmpdir.resolve('test.save.js'); // Add some data. putIn.run(testFile); @@ -79,7 +78,7 @@ testMe.complete('inner.o', common.mustSucceed((data) => { // Clear the REPL. putIn.run(['.clear']); -let loadFile = join(tmpdir.path, 'file.does.not.exist'); +let loadFile = tmpdir.resolve('file.does.not.exist'); // Should not break. putIn.write = common.mustCall(function(data) { @@ -103,7 +102,7 @@ putIn.run(['.clear']); // NUL (\0) is disallowed in filenames in UNIX-like operating systems and // Windows so we can use that to test failed saves. -const invalidFileName = join(tmpdir.path, '\0\0\0\0\0'); +const invalidFileName = tmpdir.resolve('\0\0\0\0\0'); // Should not break. putIn.write = common.mustCall(function(data) { diff --git a/test/parallel/test-snapshot-api.js b/test/parallel/test-snapshot-api.js index b66a2b2a12c9ee..38b17add3db9c1 100644 --- a/test/parallel/test-snapshot-api.js +++ b/test/parallel/test-snapshot-api.js @@ -7,7 +7,6 @@ const assert = require('assert'); const { spawnSync } = require('child_process'); const tmpdir = require('../common/tmpdir'); const fixtures = require('../common/fixtures'); -const path = require('path'); const fs = require('fs'); const v8 = require('v8'); @@ -17,7 +16,7 @@ const v8 = require('v8'); assert(!v8.startupSnapshot.isBuildingSnapshot()); tmpdir.refresh(); -const blobPath = path.join(tmpdir.path, 'snapshot.blob'); +const blobPath = tmpdir.resolve('snapshot.blob'); const entry = fixtures.path('snapshot', 'v8-startup-snapshot-api.js'); { for (const book of [ @@ -26,9 +25,9 @@ const entry = fixtures.path('snapshot', 'v8-startup-snapshot-api.js'); 'book2.zh_CN.txt', ]) { const content = `This is ${book}`; - fs.writeFileSync(path.join(tmpdir.path, book), content, 'utf8'); + fs.writeFileSync(tmpdir.resolve(book), content, 'utf8'); } - fs.copyFileSync(entry, path.join(tmpdir.path, 'entry.js')); + fs.copyFileSync(entry, tmpdir.resolve('entry.js')); const child = spawnSync(process.execPath, [ '--snapshot-blob', blobPath, @@ -42,7 +41,7 @@ const entry = fixtures.path('snapshot', 'v8-startup-snapshot-api.js'); console.log(child.stdout.toString()); 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()); } diff --git a/test/parallel/test-snapshot-argv1.js b/test/parallel/test-snapshot-argv1.js index 08ec7d905fd98e..b98e13aa8ccfed 100644 --- a/test/parallel/test-snapshot-argv1.js +++ b/test/parallel/test-snapshot-argv1.js @@ -6,18 +6,17 @@ require('../common'); const assert = require('assert'); const { spawnSync } = require('child_process'); const tmpdir = require('../common/tmpdir'); -const path = require('path'); const fs = require('fs'); tmpdir.refresh(); -const blobPath = path.join(tmpdir.path, 'snapshot.blob'); +const blobPath = tmpdir.resolve('snapshot.blob'); const code = ` require('v8').startupSnapshot.setDeserializeMainFunction(() => { console.log(JSON.stringify(process.argv)); }); `; { - fs.writeFileSync(path.join(tmpdir.path, 'entry.js'), code, 'utf8'); + fs.writeFileSync(tmpdir.resolve('entry.js'), code, 'utf8'); const child = spawnSync(process.execPath, [ '--snapshot-blob', blobPath, @@ -31,7 +30,7 @@ require('v8').startupSnapshot.setDeserializeMainFunction(() => { console.log(child.stdout.toString()); 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()); } diff --git a/test/parallel/test-snapshot-basic.js b/test/parallel/test-snapshot-basic.js index 9bcf3025011315..6f1d3c21ae1772 100644 --- a/test/parallel/test-snapshot-basic.js +++ b/test/parallel/test-snapshot-basic.js @@ -8,7 +8,6 @@ const assert = require('assert'); const { spawnSync } = require('child_process'); const tmpdir = require('../common/tmpdir'); const fixtures = require('../common/fixtures'); -const path = require('path'); const fs = require('fs'); tmpdir.refresh(); @@ -48,12 +47,12 @@ if (!process.config.variables.node_use_node_snapshot) { console.log(child.signal); 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()); } tmpdir.refresh(); -const blobPath = path.join(tmpdir.path, 'my-snapshot.blob'); +const blobPath = tmpdir.resolve('my-snapshot.blob'); { // Create the snapshot. const child = spawnSync(process.execPath, [ diff --git a/test/parallel/test-snapshot-cjs-main.js b/test/parallel/test-snapshot-cjs-main.js index b445a5a2739142..f58e4f1790934b 100644 --- a/test/parallel/test-snapshot-cjs-main.js +++ b/test/parallel/test-snapshot-cjs-main.js @@ -8,11 +8,10 @@ const assert = require('assert'); const { spawnSync } = require('child_process'); const tmpdir = require('../common/tmpdir'); const fixtures = require('../common/fixtures'); -const path = require('path'); const fs = require('fs'); tmpdir.refresh(); -const blobPath = path.join(tmpdir.path, 'snapshot.blob'); +const blobPath = tmpdir.resolve('snapshot.blob'); const file = fixtures.path('snapshot', 'mutate-fs.js'); const checkFile = fixtures.path('snapshot', 'check-mutate-fs.js'); diff --git a/test/parallel/test-snapshot-console.js b/test/parallel/test-snapshot-console.js index f3c805dc4bf8fe..4acc804b201539 100644 --- a/test/parallel/test-snapshot-console.js +++ b/test/parallel/test-snapshot-console.js @@ -9,11 +9,10 @@ const assert = require('assert'); const { spawnSync } = require('child_process'); const tmpdir = require('../common/tmpdir'); const fixtures = require('../common/fixtures'); -const path = require('path'); const fs = require('fs'); tmpdir.refresh(); -const blobPath = path.join(tmpdir.path, 'snapshot.blob'); +const blobPath = tmpdir.resolve('snapshot.blob'); const entry = fixtures.path('snapshot', 'console.js'); { @@ -32,7 +31,7 @@ const entry = fixtures.path('snapshot', 'console.js'); assert.strictEqual(child.status, 0); } assert.deepStrictEqual(Object.keys(console), JSON.parse(stdout)); - const stats = fs.statSync(path.join(tmpdir.path, 'snapshot.blob')); + const stats = fs.statSync(tmpdir.resolve('snapshot.blob')); assert(stats.isFile()); } diff --git a/test/parallel/test-snapshot-error.js b/test/parallel/test-snapshot-error.js index 32f41244c725e2..1d90e7b181b0f0 100644 --- a/test/parallel/test-snapshot-error.js +++ b/test/parallel/test-snapshot-error.js @@ -8,11 +8,10 @@ const assert = require('assert'); const { spawnSync } = require('child_process'); const tmpdir = require('../common/tmpdir'); const fixtures = require('../common/fixtures'); -const path = require('path'); const fs = require('fs'); tmpdir.refresh(); -const blobPath = path.join(tmpdir.path, 'snapshot.blob'); +const blobPath = tmpdir.resolve('snapshot.blob'); const entry = fixtures.path('snapshot', 'error.js'); // --build-snapshot should be run with an entry point. @@ -31,7 +30,7 @@ const entry = fixtures.path('snapshot', 'error.js'); assert.strictEqual(child.status, 9); assert.match(stderr, /--build-snapshot must be used with an entry point script/); - assert(!fs.existsSync(path.join(tmpdir.path, 'snapshot.blob'))); + assert(!fs.existsSync(tmpdir.resolve('snapshot.blob'))); } // Loading a non-existent snapshot should fail. @@ -49,7 +48,7 @@ const entry = fixtures.path('snapshot', 'error.js'); console.log(child.stdout.toString()); assert.strictEqual(child.status, 14); assert.match(stderr, /Cannot open/); - assert(!fs.existsSync(path.join(tmpdir.path, 'snapshot.blob'))); + assert(!fs.existsSync(tmpdir.resolve('snapshot.blob'))); } @@ -69,5 +68,5 @@ const entry = fixtures.path('snapshot', 'error.js'); console.log(child.stdout.toString()); assert.strictEqual(child.status, 1); assert.match(stderr, /error\.js:1/); - assert(!fs.existsSync(path.join(tmpdir.path, 'snapshot.blob'))); + assert(!fs.existsSync(tmpdir.resolve('snapshot.blob'))); } diff --git a/test/parallel/test-snapshot-eval.js b/test/parallel/test-snapshot-eval.js index 4cb1309df97d59..6a1b6b4e0197eb 100644 --- a/test/parallel/test-snapshot-eval.js +++ b/test/parallel/test-snapshot-eval.js @@ -8,11 +8,10 @@ const assert = require('assert'); const { spawnSync } = require('child_process'); const tmpdir = require('../common/tmpdir'); const fixtures = require('../common/fixtures'); -const path = require('path'); const fs = require('fs'); tmpdir.refresh(); -const blobPath = path.join(tmpdir.path, 'snapshot.blob'); +const blobPath = tmpdir.resolve('snapshot.blob'); const file = fixtures.path('snapshot', 'mutate-fs.js'); { diff --git a/test/parallel/test-snapshot-gzip.js b/test/parallel/test-snapshot-gzip.js index 2ee6cae1979211..cd46bfce45aa47 100644 --- a/test/parallel/test-snapshot-gzip.js +++ b/test/parallel/test-snapshot-gzip.js @@ -8,11 +8,10 @@ const assert = require('assert'); const { spawnSync } = require('child_process'); const tmpdir = require('../common/tmpdir'); const fixtures = require('../common/fixtures'); -const path = require('path'); const fs = require('fs'); tmpdir.refresh(); -const blobPath = path.join(tmpdir.path, 'snapshot.blob'); +const blobPath = tmpdir.resolve('snapshot.blob'); const file = fixtures.path('snapshot', 'decompress-gzip-sync.js'); { @@ -36,7 +35,7 @@ const file = fixtures.path('snapshot', 'decompress-gzip-sync.js'); console.log(stdout); 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()); assert(stdout.includes('NODE_TEST_MODE: snapshot')); } diff --git a/test/parallel/test-snapshot-incompatible.js b/test/parallel/test-snapshot-incompatible.js index d90c791ac28676..28d1a83a1f7664 100644 --- a/test/parallel/test-snapshot-incompatible.js +++ b/test/parallel/test-snapshot-incompatible.js @@ -8,11 +8,10 @@ const assert = require('assert'); const { spawnSync } = require('child_process'); const tmpdir = require('../common/tmpdir'); const fixtures = require('../common/fixtures'); -const path = require('path'); const fs = require('fs'); tmpdir.refresh(); -const blobPath = path.join(tmpdir.path, 'snapshot.blob'); +const blobPath = tmpdir.resolve('snapshot.blob'); const entry = fixtures.path('empty.js'); // The flag used can be any flag that makes a difference in @@ -34,7 +33,7 @@ const entry = fixtures.path('empty.js'); console.log(child.stdout.toString()); 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()); } diff --git a/test/parallel/test-snapshot-namespaced-builtin.js b/test/parallel/test-snapshot-namespaced-builtin.js index f3989273070333..db1219e5cf0da1 100644 --- a/test/parallel/test-snapshot-namespaced-builtin.js +++ b/test/parallel/test-snapshot-namespaced-builtin.js @@ -6,11 +6,10 @@ require('../common'); const assert = require('assert'); const { spawnSync } = require('child_process'); const tmpdir = require('../common/tmpdir'); -const path = require('path'); const fs = require('fs'); tmpdir.refresh(); -const blobPath = path.join(tmpdir.path, 'snapshot.blob'); +const blobPath = tmpdir.resolve('snapshot.blob'); { // The list of modules supported in the snapshot is unstable, so just check // a few that are known to work. @@ -20,7 +19,7 @@ const blobPath = path.join(tmpdir.path, 'snapshot.blob'); require("node:fs/promises"); `; fs.writeFileSync( - path.join(tmpdir.path, 'entry.js'), + tmpdir.resolve('entry.js'), code, 'utf8' ); @@ -37,6 +36,6 @@ const blobPath = path.join(tmpdir.path, 'snapshot.blob'); console.log(child.stdout.toString()); 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()); } diff --git a/test/parallel/test-snapshot-net.js b/test/parallel/test-snapshot-net.js index 9406f16609e6b8..1fdebf64fce763 100644 --- a/test/parallel/test-snapshot-net.js +++ b/test/parallel/test-snapshot-net.js @@ -8,11 +8,10 @@ const assert = require('assert'); const { spawnSync } = require('child_process'); const tmpdir = require('../common/tmpdir'); const fixtures = require('../common/fixtures'); -const path = require('path'); const fs = require('fs'); tmpdir.refresh(); -const blobPath = path.join(tmpdir.path, 'snapshot.blob'); +const blobPath = tmpdir.resolve('snapshot.blob'); const entry = fixtures.path('snapshot', 'server.js'); { const child = spawnSync(process.execPath, [ @@ -28,7 +27,7 @@ const entry = fixtures.path('snapshot', 'server.js'); console.log(child.stdout.toString()); 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()); } diff --git a/test/parallel/test-snapshot-typescript.js b/test/parallel/test-snapshot-typescript.js index 0d0832648dfe2b..98502ccebedfc1 100644 --- a/test/parallel/test-snapshot-typescript.js +++ b/test/parallel/test-snapshot-typescript.js @@ -8,16 +8,15 @@ const assert = require('assert'); const { spawnSync } = require('child_process'); const tmpdir = require('../common/tmpdir'); const fixtures = require('../common/fixtures'); -const path = require('path'); const fs = require('fs'); tmpdir.refresh(); -const blobPath = path.join(tmpdir.path, 'snapshot.blob'); +const blobPath = tmpdir.resolve('snapshot.blob'); // Concat test/fixtures/snapshot/typescript.js with // test/fixtures/snapshot/typescript.js into // tmpdir/snapshot.js. -const file = path.join(tmpdir.path, 'snapshot.js'); +const file = tmpdir.resolve('snapshot.js'); fs.copyFileSync(fixtures.path('snapshot', 'typescript.js'), file); fs.appendFileSync(file, fs.readFileSync(fixtures.path('snapshot', 'typescript-main.js'))); @@ -37,12 +36,12 @@ fs.appendFileSync(file, console.log(stdout); 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()); } { - const outPath = path.join(tmpdir.path, 'ts-example.js'); + const outPath = tmpdir.resolve('ts-example.js'); const child = spawnSync(process.execPath, [ '--snapshot-blob', blobPath, diff --git a/test/parallel/test-snapshot-umd.js b/test/parallel/test-snapshot-umd.js index 70a7c1ac69a883..9dcc89b75a6c0c 100644 --- a/test/parallel/test-snapshot-umd.js +++ b/test/parallel/test-snapshot-umd.js @@ -7,11 +7,10 @@ const assert = require('assert'); const { spawnSync } = require('child_process'); const tmpdir = require('../common/tmpdir'); const fixtures = require('../common/fixtures'); -const path = require('path'); const fs = require('fs'); tmpdir.refresh(); -const blobPath = path.join(tmpdir.path, 'snapshot.blob'); +const blobPath = tmpdir.resolve('snapshot.blob'); const file = fixtures.path('snapshot', 'marked.js'); { @@ -30,14 +29,14 @@ const file = fixtures.path('snapshot', 'marked.js'); console.log(stdout); 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()); } { let child = spawnSync(process.execPath, [ '--snapshot-blob', - path.join(tmpdir.path, 'snapshot.blob'), + tmpdir.resolve('snapshot.blob'), fixtures.path('snapshot', 'check-marked.js'), ], { cwd: tmpdir.path, diff --git a/test/parallel/test-snapshot-warning.js b/test/parallel/test-snapshot-warning.js index 357749ad8e6875..2ca87f1ef5f055 100644 --- a/test/parallel/test-snapshot-warning.js +++ b/test/parallel/test-snapshot-warning.js @@ -10,11 +10,10 @@ const assert = require('assert'); const { spawnSync } = require('child_process'); const tmpdir = require('../common/tmpdir'); const fixtures = require('../common/fixtures'); -const path = require('path'); const fs = require('fs'); const warningScript = fixtures.path('snapshot', 'warning.js'); -const blobPath = path.join(tmpdir.path, 'snapshot.blob'); +const blobPath = tmpdir.resolve('snapshot.blob'); const empty = fixtures.path('empty.js'); tmpdir.refresh(); @@ -102,8 +101,8 @@ tmpdir.refresh(); tmpdir.refresh(); { console.log('\n# Check --redirect-warnings'); - const warningFile1 = path.join(tmpdir.path, 'warnings.txt'); - const warningFile2 = path.join(tmpdir.path, 'warnings2.txt'); + const warningFile1 = tmpdir.resolve('warnings.txt'); + const warningFile2 = tmpdir.resolve('warnings2.txt'); let child = spawnSync(process.execPath, [ '--snapshot-blob', diff --git a/test/parallel/test-snapshot-weak-reference.js b/test/parallel/test-snapshot-weak-reference.js index 6de072290da257..b7b17ddbefb406 100644 --- a/test/parallel/test-snapshot-weak-reference.js +++ b/test/parallel/test-snapshot-weak-reference.js @@ -7,11 +7,10 @@ const assert = require('assert'); const { spawnSync } = require('child_process'); const tmpdir = require('../common/tmpdir'); const fixtures = require('../common/fixtures'); -const path = require('path'); const fs = require('fs'); tmpdir.refresh(); -const blobPath = path.join(tmpdir.path, 'snapshot.blob'); +const blobPath = tmpdir.resolve('snapshot.blob'); function runTest(entry) { console.log('running test with', entry); @@ -31,7 +30,7 @@ function runTest(entry) { console.log(child.stdout.toString()); 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()); } diff --git a/test/parallel/test-snapshot-worker.js b/test/parallel/test-snapshot-worker.js index 6fe5aa9638a8c5..36705d358c7806 100644 --- a/test/parallel/test-snapshot-worker.js +++ b/test/parallel/test-snapshot-worker.js @@ -7,11 +7,10 @@ const assert = require('assert'); const { spawnSync } = require('child_process'); const tmpdir = require('../common/tmpdir'); const fixtures = require('../common/fixtures'); -const path = require('path'); const fs = require('fs'); tmpdir.refresh(); -const blobPath = path.join(tmpdir.path, 'snapshot.blob'); +const blobPath = tmpdir.resolve('snapshot.blob'); const entry = fixtures.path('snapshot', 'worker.js'); { const child = spawnSync(process.execPath, [ diff --git a/test/parallel/test-trace-events-all.js b/test/parallel/test-trace-events-all.js index 8e836561ff7091..9b0549eeb8bef0 100644 --- a/test/parallel/test-trace-events-all.js +++ b/test/parallel/test-trace-events-all.js @@ -3,14 +3,13 @@ const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); const fs = require('fs'); -const path = require('path'); const CODE = 'setTimeout(() => { for (let i = 0; i < 100000; i++) { "test" + i } }, 1)'; const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const FILE_NAME = path.join(tmpdir.path, 'node_trace.1.log'); +const FILE_NAME = tmpdir.resolve('node_trace.1.log'); const proc = cp.spawn(process.execPath, [ '--trace-events-enabled', '-e', CODE ], diff --git a/test/parallel/test-trace-events-api.js b/test/parallel/test-trace-events-api.js index 5e0966fe7d78b7..70520d7e30bbcb 100644 --- a/test/parallel/test-trace-events-api.js +++ b/test/parallel/test-trace-events-api.js @@ -12,7 +12,6 @@ try { const assert = require('assert'); const cp = require('child_process'); -const path = require('path'); const fs = require('fs'); const tmpdir = require('../common/tmpdir'); const { @@ -147,7 +146,7 @@ function testApiInChildProcess(execArgs, cb) { }); proc.once('exit', common.mustCall(() => { - const file = path.join(tmpdir.path, 'node_trace.1.log'); + const file = tmpdir.resolve('node_trace.1.log'); assert(fs.existsSync(file)); fs.readFile(file, common.mustSucceed((data) => { diff --git a/test/parallel/test-trace-events-async-hooks-dynamic.js b/test/parallel/test-trace-events-async-hooks-dynamic.js index a1b59d48c03875..8144632a71381c 100644 --- a/test/parallel/test-trace-events-async-hooks-dynamic.js +++ b/test/parallel/test-trace-events-async-hooks-dynamic.js @@ -13,7 +13,6 @@ try { const assert = require('assert'); const cp = require('child_process'); const fs = require('fs'); -const path = require('path'); const enable = `require("trace_events").createTracing( { categories: ["node.async_hooks"] }).enable();`; @@ -21,7 +20,7 @@ const code = 'setTimeout(() => { for (let i = 0; i < 100000; i++) { "test" + i } }, 1)'; const tmpdir = require('../common/tmpdir'); -const filename = path.join(tmpdir.path, 'node_trace.1.log'); +const filename = tmpdir.resolve('node_trace.1.log'); tmpdir.refresh(); const proc = cp.spawnSync( diff --git a/test/parallel/test-trace-events-async-hooks-worker.js b/test/parallel/test-trace-events-async-hooks-worker.js index 7807a29925ca11..5204a50e3e159c 100644 --- a/test/parallel/test-trace-events-async-hooks-worker.js +++ b/test/parallel/test-trace-events-async-hooks-worker.js @@ -13,7 +13,6 @@ try { const assert = require('assert'); const cp = require('child_process'); const fs = require('fs'); -const path = require('path'); const code = 'setTimeout(() => { for (let i = 0; i < 100000; i++) { "test" + i } }, 1)'; @@ -28,7 +27,7 @@ worker.stderr.on('data', worker.on('exit', () => { ${code} })`; const tmpdir = require('../common/tmpdir'); -const filename = path.join(tmpdir.path, 'node_trace.1.log'); +const filename = tmpdir.resolve('node_trace.1.log'); tmpdir.refresh(); const proc = cp.spawnSync( diff --git a/test/parallel/test-trace-events-async-hooks.js b/test/parallel/test-trace-events-async-hooks.js index eecce9e5e43ab3..90d4fbc8b7aaa0 100644 --- a/test/parallel/test-trace-events-async-hooks.js +++ b/test/parallel/test-trace-events-async-hooks.js @@ -3,7 +3,6 @@ const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); const fs = require('fs'); -const path = require('path'); const util = require('util'); const CODE = @@ -11,7 +10,7 @@ const CODE = const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const FILE_NAME = path.join(tmpdir.path, 'node_trace.1.log'); +const FILE_NAME = tmpdir.resolve('node_trace.1.log'); const proc = cp.spawn(process.execPath, [ '--trace-event-categories', 'node.async_hooks', diff --git a/test/parallel/test-trace-events-binding.js b/test/parallel/test-trace-events-binding.js index a6994d47b3e695..0f14614994085e 100644 --- a/test/parallel/test-trace-events-binding.js +++ b/test/parallel/test-trace-events-binding.js @@ -3,7 +3,6 @@ const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); const fs = require('fs'); -const path = require('path'); const CODE = ` const { internalBinding } = require('internal/test/binding'); @@ -19,7 +18,7 @@ const CODE = ` const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const FILE_NAME = path.join(tmpdir.path, 'node_trace.1.log'); +const FILE_NAME = tmpdir.resolve('node_trace.1.log'); const proc = cp.spawn(process.execPath, [ '--trace-event-categories', 'custom', diff --git a/test/parallel/test-trace-events-bootstrap.js b/test/parallel/test-trace-events-bootstrap.js index 3b9cb95a69f7b6..9497bd896e7bd6 100644 --- a/test/parallel/test-trace-events-bootstrap.js +++ b/test/parallel/test-trace-events-bootstrap.js @@ -3,7 +3,6 @@ const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); const fs = require('fs'); -const path = require('path'); const tmpdir = require('../common/tmpdir'); const names = [ @@ -30,7 +29,7 @@ if (process.argv[2] === 'child') { }); proc.once('exit', common.mustCall(() => { - const file = path.join(tmpdir.path, 'node_trace.1.log'); + const file = tmpdir.resolve('node_trace.1.log'); assert(fs.existsSync(file)); fs.readFile(file, common.mustCall((err, data) => { diff --git a/test/parallel/test-trace-events-console.js b/test/parallel/test-trace-events-console.js index 01a532d69e704a..4c9fa35cbafd6f 100644 --- a/test/parallel/test-trace-events-console.js +++ b/test/parallel/test-trace-events-console.js @@ -2,7 +2,6 @@ const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); -const path = require('path'); const fs = require('fs'); const tmpdir = require('../common/tmpdir'); @@ -42,7 +41,7 @@ if (process.argv[2] === 'child') { }); proc.once('exit', common.mustCall(async () => { - const file = path.join(tmpdir.path, 'node_trace.1.log'); + const file = tmpdir.resolve('node_trace.1.log'); assert(fs.existsSync(file)); const data = await fs.promises.readFile(file, { encoding: 'utf8' }); diff --git a/test/parallel/test-trace-events-environment.js b/test/parallel/test-trace-events-environment.js index 8105b8394b0d71..571c71c41133d9 100644 --- a/test/parallel/test-trace-events-environment.js +++ b/test/parallel/test-trace-events-environment.js @@ -4,7 +4,6 @@ const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); -const path = require('path'); const fs = require('fs'); const tmpdir = require('../common/tmpdir'); @@ -42,7 +41,7 @@ if (process.argv[2] === 'child') { }); proc.once('exit', common.mustCall(async () => { - const file = path.join(tmpdir.path, 'node_trace.1.log'); + const file = tmpdir.resolve('node_trace.1.log'); const checkSet = new Set(); assert(fs.existsSync(file)); diff --git a/test/parallel/test-trace-events-file-pattern.js b/test/parallel/test-trace-events-file-pattern.js index 0c5097b2e174fd..d1b02c2e49c163 100644 --- a/test/parallel/test-trace-events-file-pattern.js +++ b/test/parallel/test-trace-events-file-pattern.js @@ -4,7 +4,6 @@ const tmpdir = require('../common/tmpdir'); const assert = require('assert'); const cp = require('child_process'); const fs = require('fs'); -const path = require('path'); tmpdir.refresh(); @@ -20,8 +19,7 @@ const proc = cp.spawn(process.execPath, [ ], { cwd: tmpdir.path }); proc.once('exit', common.mustCall(() => { - const expectedFilename = path.join(tmpdir.path, - `${proc.pid}-1-${proc.pid}-1.tracing.log`); + const expectedFilename = tmpdir.resolve(`${proc.pid}-1-${proc.pid}-1.tracing.log`); assert(fs.existsSync(expectedFilename)); fs.readFile(expectedFilename, common.mustCall((err, data) => { diff --git a/test/parallel/test-trace-events-fs-async.js b/test/parallel/test-trace-events-fs-async.js index 469da286a34d3b..848d0e5f558870 100644 --- a/test/parallel/test-trace-events-fs-async.js +++ b/test/parallel/test-trace-events-fs-async.js @@ -3,7 +3,6 @@ const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); const fs = require('fs'); -const path = require('path'); const util = require('util'); const tests = { __proto__: null }; @@ -305,7 +304,7 @@ if (common.canCreateSymLink()) { } const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const traceFile = path.join(tmpdir.path, 'node_trace.1.log'); +const traceFile = tmpdir.resolve('node_trace.1.log'); for (const tr in tests) { const proc = cp.spawnSync(process.execPath, diff --git a/test/parallel/test-trace-events-fs-sync.js b/test/parallel/test-trace-events-fs-sync.js index d945e7f38239e6..a8a6aa11c76533 100644 --- a/test/parallel/test-trace-events-fs-sync.js +++ b/test/parallel/test-trace-events-fs-sync.js @@ -3,7 +3,6 @@ const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); const fs = require('fs'); -const path = require('path'); const util = require('util'); const tests = { __proto__: null }; @@ -116,7 +115,7 @@ if (common.canCreateSymLink()) { const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const traceFile = path.join(tmpdir.path, 'node_trace.1.log'); +const traceFile = tmpdir.resolve('node_trace.1.log'); for (const tr in tests) { const proc = cp.spawnSync(process.execPath, diff --git a/test/parallel/test-trace-events-http.js b/test/parallel/test-trace-events-http.js index 54e3d4f06e492b..bcdc897e2ff136 100644 --- a/test/parallel/test-trace-events-http.js +++ b/test/parallel/test-trace-events-http.js @@ -3,7 +3,6 @@ const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); const fs = require('fs'); -const path = require('path'); const tmpdir = require('../common/tmpdir'); const CODE = ` @@ -17,7 +16,7 @@ const CODE = ` `; tmpdir.refresh(); -const FILE_NAME = path.join(tmpdir.path, 'node_trace.1.log'); +const FILE_NAME = tmpdir.resolve('node_trace.1.log'); const proc = cp.spawn(process.execPath, [ '--trace-events-enabled', diff --git a/test/parallel/test-trace-events-metadata.js b/test/parallel/test-trace-events-metadata.js index ba700d6c9370ea..3a86698e1f7db6 100644 --- a/test/parallel/test-trace-events-metadata.js +++ b/test/parallel/test-trace-events-metadata.js @@ -3,7 +3,6 @@ const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); const fs = require('fs'); -const path = require('path'); const CODE = 'setTimeout(() => { for (let i = 0; i < 100000; i++) { "test" + i } }, 1);' + @@ -11,7 +10,7 @@ const CODE = const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const FILE_NAME = path.join(tmpdir.path, 'node_trace.1.log'); +const FILE_NAME = tmpdir.resolve('node_trace.1.log'); const proc = cp.spawn(process.execPath, [ '--trace-event-categories', 'node.perf.usertiming', diff --git a/test/parallel/test-trace-events-net.js b/test/parallel/test-trace-events-net.js index 227c168c013245..c605cb5bd087b6 100644 --- a/test/parallel/test-trace-events-net.js +++ b/test/parallel/test-trace-events-net.js @@ -3,7 +3,6 @@ const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); const fs = require('fs'); -const path = require('path'); const tmpdir = require('../common/tmpdir'); const CODE = ` @@ -19,7 +18,7 @@ const CODE = ` `; tmpdir.refresh(); -const FILE_NAME = path.join(tmpdir.path, 'node_trace.1.log'); +const FILE_NAME = tmpdir.resolve('node_trace.1.log'); const proc = cp.spawn(process.execPath, [ '--trace-events-enabled', diff --git a/test/parallel/test-trace-events-none.js b/test/parallel/test-trace-events-none.js index d6ec35677d3fe1..53121ac7df056f 100644 --- a/test/parallel/test-trace-events-none.js +++ b/test/parallel/test-trace-events-none.js @@ -3,14 +3,13 @@ const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); const fs = require('fs'); -const path = require('path'); const CODE = 'setTimeout(() => { for (let i = 0; i < 100000; i++) { "test" + i } }, 1)'; const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const FILE_NAME = path.join(tmpdir.path, 'node_trace.1.log'); +const FILE_NAME = tmpdir.resolve('node_trace.1.log'); const proc_no_categories = cp.spawn( process.execPath, diff --git a/test/parallel/test-trace-events-process-exit.js b/test/parallel/test-trace-events-process-exit.js index 1a39b889a3c809..fc81c1eb7ce466 100644 --- a/test/parallel/test-trace-events-process-exit.js +++ b/test/parallel/test-trace-events-process-exit.js @@ -3,11 +3,10 @@ const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); const fs = require('fs'); -const path = require('path'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const FILE_NAME = path.join(tmpdir.path, 'node_trace.1.log'); +const FILE_NAME = tmpdir.resolve('node_trace.1.log'); const proc = cp.spawn(process.execPath, [ '--trace-events-enabled', diff --git a/test/parallel/test-trace-events-promises.js b/test/parallel/test-trace-events-promises.js index 37e4866c6b8afc..91e3c4fcda7104 100644 --- a/test/parallel/test-trace-events-promises.js +++ b/test/parallel/test-trace-events-promises.js @@ -3,7 +3,6 @@ const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); const fs = require('fs'); -const path = require('path'); const tmpdir = require('../common/tmpdir'); if (process.argv[2] === 'child') { @@ -26,7 +25,7 @@ if (process.argv[2] === 'child') { }); proc.once('exit', common.mustCall(() => { - const file = path.join(tmpdir.path, 'node_trace.1.log'); + const file = tmpdir.resolve('node_trace.1.log'); assert(fs.existsSync(file)); fs.readFile(file, common.mustCall((err, data) => { diff --git a/test/parallel/test-trace-events-threadpool.js b/test/parallel/test-trace-events-threadpool.js index a5af5e78661dab..52d5a65c6035a3 100644 --- a/test/parallel/test-trace-events-threadpool.js +++ b/test/parallel/test-trace-events-threadpool.js @@ -3,7 +3,6 @@ const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); const fs = require('fs'); -const path = require('path'); const tmpdir = require('../common/tmpdir'); const { scheduler } = require('timers/promises'); @@ -21,7 +20,7 @@ if (process.env.isChild === '1') { } tmpdir.refresh(); -const FILE_NAME = path.join(tmpdir.path, 'node_trace.1.log'); +const FILE_NAME = tmpdir.resolve('node_trace.1.log'); cp.spawnSync(process.execPath, [ diff --git a/test/parallel/test-trace-events-v8.js b/test/parallel/test-trace-events-v8.js index e5fc8b6c726600..f3724ce6df44c6 100644 --- a/test/parallel/test-trace-events-v8.js +++ b/test/parallel/test-trace-events-v8.js @@ -3,14 +3,13 @@ const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); const fs = require('fs'); -const path = require('path'); const CODE = 'setTimeout(() => { for (let i = 0; i < 100000; i++) { "test" + i } }, 1)'; const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const FILE_NAME = path.join(tmpdir.path, 'node_trace.1.log'); +const FILE_NAME = tmpdir.resolve('node_trace.1.log'); const proc = cp.spawn(process.execPath, [ '--trace-events-enabled', diff --git a/test/parallel/test-trace-events-vm.js b/test/parallel/test-trace-events-vm.js index e7c5fb0bc0e416..b52d22368d07d2 100644 --- a/test/parallel/test-trace-events-vm.js +++ b/test/parallel/test-trace-events-vm.js @@ -3,7 +3,6 @@ const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); const fs = require('fs'); -const path = require('path'); const tmpdir = require('../common/tmpdir'); const names = [ @@ -27,7 +26,7 @@ if (process.argv[2] === 'child') { }); proc.once('exit', common.mustCall(() => { - const file = path.join(tmpdir.path, 'node_trace.1.log'); + const file = tmpdir.resolve('node_trace.1.log'); assert(fs.existsSync(file)); fs.readFile(file, common.mustCall((err, data) => {