Skip to content

Commit 4a24ffc

Browse files
LiviaMedeirosRafaelGSS
authored andcommitted
test: use tmpdir.resolve()
PR-URL: #49128 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
1 parent 58512eb commit 4a24ffc

File tree

52 files changed

+119
-151
lines changed

Some content is hidden

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

52 files changed

+119
-151
lines changed

test/parallel/test-common.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const tmpdir = require('../common/tmpdir');
2727
const assert = require('assert');
2828
const { execFile } = require('child_process');
2929
const { writeFileSync, existsSync } = require('fs');
30-
const { join } = require('path');
3130

3231
// Test for leaked global detection
3332
{
@@ -134,7 +133,7 @@ const HIJACK_TEST_ARRAY = [ 'foo\n', 'bar\n', 'baz\n' ];
134133
{
135134
tmpdir.refresh();
136135
assert.match(tmpdir.path, /\.tmp\.\d+/);
137-
const sentinelPath = join(tmpdir.path, 'gaga');
136+
const sentinelPath = tmpdir.resolve('gaga');
138137
writeFileSync(sentinelPath, 'googoo');
139138
tmpdir.refresh();
140139
assert.strictEqual(existsSync(tmpdir.path), true);

test/parallel/test-debugger-heap-profiler.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ common.skipIfInspectorDisabled();
66
const fixtures = require('../common/fixtures');
77
const startCLI = require('../common/debugger');
88
const tmpdir = require('../common/tmpdir');
9-
const path = require('path');
109

1110
tmpdir.refresh();
1211

1312
const { readFileSync } = require('fs');
1413

15-
const filename = path.join(tmpdir.path, 'node.heapsnapshot');
14+
const filename = tmpdir.resolve('node.heapsnapshot');
1615

1716
// Heap profiler take snapshot.
1817
{

test/parallel/test-file-write-stream.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@
2323
const common = require('../common');
2424
const assert = require('assert');
2525

26-
const path = require('path');
2726
const fs = require('fs');
2827
const tmpdir = require('../common/tmpdir');
29-
const fn = path.join(tmpdir.path, 'write.txt');
28+
const fn = tmpdir.resolve('write.txt');
3029
tmpdir.refresh();
3130
const file = fs.createWriteStream(fn, {
3231
highWaterMark: 10

test/parallel/test-file-write-stream2.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@
2323
require('../common');
2424
const assert = require('assert');
2525

26-
const path = require('path');
2726
const fs = require('fs');
2827

2928
const tmpdir = require('../common/tmpdir');
3029

3130

32-
const filepath = path.join(tmpdir.path, 'write.txt');
31+
const filepath = tmpdir.resolve('write.txt');
3332

3433
const EXPECTED = '012345678910';
3534

test/parallel/test-file-write-stream3.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@
2222
'use strict';
2323
const common = require('../common');
2424
const assert = require('assert');
25-
const path = require('path');
2625
const fs = require('fs');
2726

2827
const tmpdir = require('../common/tmpdir');
2928

3029

31-
const filepath = path.join(tmpdir.path, 'write_pos.txt');
30+
const filepath = tmpdir.resolve('write_pos.txt');
3231

3332

3433
const cb_expected = 'write open close write open close write open close ';

test/parallel/test-file-write-stream4.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
// Refs: https://github.com/nodejs/node/issues/31366
55

66
const common = require('../common');
7-
const path = require('path');
87
const fs = require('fs');
98

109
const tmpdir = require('../common/tmpdir');
1110
tmpdir.refresh();
1211

13-
const filepath = path.join(tmpdir.path, 'write_pos.txt');
12+
const filepath = tmpdir.resolve('write_pos.txt');
1413

1514
const fileReadStream = fs.createReadStream(process.execPath);
1615
const fileWriteStream = fs.createWriteStream(filepath, {

test/parallel/test-heap-prof-dir-absolute.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ common.skipIfInspectorDisabled();
99

1010
const assert = require('assert');
1111
const fs = require('fs');
12-
const path = require('path');
1312
const { spawnSync } = require('child_process');
1413

1514
const tmpdir = require('../common/tmpdir');
@@ -24,7 +23,7 @@ const {
2423
// Tests absolute --heap-prof-dir
2524
{
2625
tmpdir.refresh();
27-
const dir = path.join(tmpdir.path, 'prof');
26+
const dir = tmpdir.resolve('prof');
2827
const output = spawnSync(process.execPath, [
2928
'--heap-prof',
3029
'--heap-prof-dir',

test/parallel/test-heap-prof-dir-name.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const {
2323

2424
{
2525
tmpdir.refresh();
26-
const dir = path.join(tmpdir.path, 'prof');
26+
const dir = tmpdir.resolve('prof');
2727
const file = path.join(dir, 'test.heapprofile');
2828
const output = spawnSync(process.execPath, [
2929
'--heap-prof',

test/parallel/test-heap-prof-dir-relative.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ common.skipIfInspectorDisabled();
99

1010
const assert = require('assert');
1111
const fs = require('fs');
12-
const path = require('path');
1312
const { spawnSync } = require('child_process');
1413

1514
const tmpdir = require('../common/tmpdir');
@@ -38,7 +37,7 @@ const {
3837
console.log(output.stderr.toString());
3938
}
4039
assert.strictEqual(output.status, 0);
41-
const dir = path.join(tmpdir.path, 'prof');
40+
const dir = tmpdir.resolve('prof');
4241
assert(fs.existsSync(dir));
4342
const profiles = getHeapProfiles(dir);
4443
assert.strictEqual(profiles.length, 1);

test/parallel/test-heap-prof-interval.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ common.skipIfInspectorDisabled();
99

1010
const assert = require('assert');
1111
const fs = require('fs');
12-
const path = require('path');
1312
const { spawnSync } = require('child_process');
1413

1514
const tmpdir = require('../common/tmpdir');
@@ -38,7 +37,7 @@ const {
3837
console.log(output.stderr.toString());
3938
}
4039
assert.strictEqual(output.status, 0);
41-
const dir = path.join(tmpdir.path, 'prof');
40+
const dir = tmpdir.resolve('prof');
4241
assert(fs.existsSync(dir));
4342
const profiles = getHeapProfiles(dir);
4443
assert.strictEqual(profiles.length, 2);

0 commit comments

Comments
 (0)