Skip to content

Commit 6595367

Browse files
LiviaMedeirosRafaelGSS
authored andcommitted
test: use tmpdir.resolve()
Subsystems: blob, child_process, common, crypto, http, http2, readline, repl, snapshot, trace_events PR-URL: #49127 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Debadree Chatterjee <[email protected]>
1 parent 661b055 commit 6595367

File tree

60 files changed

+92
-154
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+92
-154
lines changed

test/parallel/test-blob-file-backed.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ const {
1515
const {
1616
unlink
1717
} = require('fs/promises');
18-
const path = require('path');
1918
const { Blob } = require('buffer');
2019

2120
const tmpdir = require('../common/tmpdir');
22-
const testfile = path.join(tmpdir.path, 'test-file-backed-blob.txt');
23-
const testfile2 = path.join(tmpdir.path, 'test-file-backed-blob2.txt');
24-
const testfile3 = path.join(tmpdir.path, 'test-file-backed-blob3.txt');
21+
const testfile = tmpdir.resolve('test-file-backed-blob.txt');
22+
const testfile2 = tmpdir.resolve('test-file-backed-blob2.txt');
23+
const testfile3 = tmpdir.resolve('test-file-backed-blob3.txt');
2524
tmpdir.refresh();
2625

2726
const data = `${'a'.repeat(1000)}${'b'.repeat(2000)}`;

test/parallel/test-child-process-fork-exec-path.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,12 @@ const common = require('../common');
2727
const tmpdir = require('../common/tmpdir');
2828
const { addLibraryPath } = require('../common/shared-lib-util');
2929
const assert = require('assert');
30-
const path = require('path');
3130
const fs = require('fs');
3231
const { fork } = require('child_process');
3332

3433
const msg = { test: 'this' };
3534
const nodePath = process.execPath;
36-
const copyPath = path.join(tmpdir.path, 'node-copy.exe');
35+
const copyPath = tmpdir.resolve('node-copy.exe');
3736

3837
addLibraryPath(process.env);
3938

test/parallel/test-child-process-pipe-dataflow.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22
const common = require('../common');
33
const assert = require('assert');
4-
const path = require('path');
54
const fs = require('fs');
65
const spawn = require('child_process').spawn;
76
const tmpdir = require('../common/tmpdir');
@@ -18,7 +17,7 @@ const MB = KB * KB;
1817

1918
{
2019
tmpdir.refresh();
21-
const file = path.resolve(tmpdir.path, 'data.txt');
20+
const file = tmpdir.resolve('data.txt');
2221
const buf = Buffer.alloc(MB).fill('x');
2322

2423
// Most OS commands that deal with data, attach special meanings to new line -

test/parallel/test-crypto-authenticated-stream.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ if (!common.hasCrypto)
77
const assert = require('assert');
88
const crypto = require('crypto');
99
const fs = require('fs');
10-
const path = require('path');
1110
const stream = require('stream');
1211
const tmpdir = require('../common/tmpdir');
1312

@@ -72,7 +71,7 @@ function mstream(config) {
7271

7372
function fstream(config) {
7473
const count = fstream.count++;
75-
const filename = (name) => path.join(tmpdir.path, `${name}${count}`);
74+
const filename = (name) => tmpdir.resolve(`${name}${count}`);
7675

7776
const { cipher, key, iv, aad, authTagLength, plaintextLength } = config;
7877
const expected = Buffer.alloc(plaintextLength);

test/parallel/test-crypto-sign-verify.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ if (!common.hasCrypto)
55

66
const assert = require('assert');
77
const fs = require('fs');
8-
const path = require('path');
98
const exec = require('child_process').exec;
109
const crypto = require('crypto');
1110
const fixtures = require('../common/fixtures');
@@ -617,9 +616,9 @@ assert.throws(
617616
const tmpdir = require('../common/tmpdir');
618617
tmpdir.refresh();
619618

620-
const sigfile = path.join(tmpdir.path, 's5.sig');
619+
const sigfile = tmpdir.resolve('s5.sig');
621620
fs.writeFileSync(sigfile, s5);
622-
const msgfile = path.join(tmpdir.path, 's5.msg');
621+
const msgfile = tmpdir.resolve('s5.msg');
623622
fs.writeFileSync(msgfile, msg);
624623

625624
const cmd =

test/parallel/test-http-agent-getname.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
require('../common');
44
const assert = require('assert');
55
const http = require('http');
6-
const path = require('path');
76

87
const tmpdir = require('../common/tmpdir');
98

@@ -41,7 +40,7 @@ assert.strictEqual(
4140
);
4241

4342
// unix socket
44-
const socketPath = path.join(tmpdir.path, 'foo', 'bar');
43+
const socketPath = tmpdir.resolve('foo', 'bar');
4544
assert.strictEqual(
4645
agent.getName({
4746
socketPath

test/parallel/test-http-chunk-problem.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const cp = require('child_process');
3939

4040
const tmpdir = require('../common/tmpdir');
4141

42-
const filename = require('path').join(tmpdir.path, 'big');
42+
const filename = tmpdir.resolve('big');
4343
let server;
4444

4545
function executeRequest(cb) {

test/parallel/test-http-pipe-fs.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
const common = require('../common');
2424
const http = require('http');
2525
const fs = require('fs');
26-
const path = require('path');
2726
const Countdown = require('../common/countdown');
2827
const NUMBER_OF_STREAMS = 2;
2928

@@ -32,7 +31,7 @@ const countdown = new Countdown(NUMBER_OF_STREAMS, () => server.close());
3231
const tmpdir = require('../common/tmpdir');
3332
tmpdir.refresh();
3433

35-
const file = path.join(tmpdir.path, 'http-pipe-fs-test.txt');
34+
const file = tmpdir.resolve('http-pipe-fs-test.txt');
3635

3736
const server = http.createServer(common.mustCall(function(req, res) {
3837
const stream = fs.createWriteStream(file);

test/parallel/test-http2-compat-serverrequest-pipe.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ const fixtures = require('../common/fixtures');
77
const assert = require('assert');
88
const http2 = require('http2');
99
const fs = require('fs');
10-
const path = require('path');
1110

1211
// Piping should work as expected with createWriteStream
1312

1413
const tmpdir = require('../common/tmpdir');
1514
tmpdir.refresh();
1615
const loc = fixtures.path('person-large.jpg');
17-
const fn = path.join(tmpdir.path, 'http2-url-tests.js');
16+
const fn = tmpdir.resolve('http2-url-tests.js');
1817

1918
const server = http2.createServer();
2019

test/parallel/test-http2-pipe-named-pipe.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@ const assert = require('assert');
88
const http2 = require('http2');
99
const fs = require('fs');
1010
const net = require('net');
11-
const path = require('path');
1211

1312
// HTTP/2 servers can listen on a named pipe.
1413

1514
const tmpdir = require('../common/tmpdir');
1615
tmpdir.refresh();
1716
const loc = fixtures.path('person-large.jpg');
18-
const fn = path.join(tmpdir.path, 'person-large.jpg');
17+
const fn = tmpdir.resolve('person-large.jpg');
1918

2019
const server = http2.createServer();
2120

0 commit comments

Comments
 (0)