Skip to content

Commit 350fa66

Browse files
jbergstroemMyles Borins
authored and
Myles Borins
committed
test: don't assume a certain folder structure
A few tests assumed that temp dirs always lived in the same parent folder as fixtures. Make these use `common.tmpDir` instead. PR-URL: #3325 Reviewed-By: Joao Reis <[email protected]>
1 parent 6b2ef0e commit 350fa66

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

test/parallel/test-fs-realpath.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -273,14 +273,14 @@ function test_deep_symlink_mix(callback) {
273273
}
274274

275275
/*
276-
/tmp/node-test-realpath-f1 -> ../tmp/node-test-realpath-d1/foo
277-
/tmp/node-test-realpath-d1 -> ../node-test-realpath-d2
278-
/tmp/node-test-realpath-d2/foo -> ../node-test-realpath-f2
276+
/tmp/node-test-realpath-f1 -> $tmpDir/node-test-realpath-d1/foo
277+
/tmp/node-test-realpath-d1 -> $tmpDir/node-test-realpath-d2
278+
/tmp/node-test-realpath-d2/foo -> $tmpDir/node-test-realpath-f2
279279
/tmp/node-test-realpath-f2
280280
-> /node/test/fixtures/nested-index/one/realpath-c
281281
/node/test/fixtures/nested-index/one/realpath-c
282282
-> /node/test/fixtures/nested-index/two/realpath-c
283-
/node/test/fixtures/nested-index/two/realpath-c -> ../../cycles/root.js
283+
/node/test/fixtures/nested-index/two/realpath-c -> $tmpDir/cycles/root.js
284284
/node/test/fixtures/cycles/root.js (hard)
285285
*/
286286
var entry = tmp('node-test-realpath-f1');
@@ -289,16 +289,16 @@ function test_deep_symlink_mix(callback) {
289289
fs.mkdirSync(tmp('node-test-realpath-d2'), 0o700);
290290
try {
291291
[
292-
[entry, '../' + common.tmpDirName + '/node-test-realpath-d1/foo'],
292+
[entry, common.tmpDir + '/node-test-realpath-d1/foo'],
293293
[tmp('node-test-realpath-d1'),
294-
'../' + common.tmpDirName + '/node-test-realpath-d2'],
294+
common.tmpDir + '/node-test-realpath-d2'],
295295
[tmp('node-test-realpath-d2/foo'), '../node-test-realpath-f2'],
296296
[tmp('node-test-realpath-f2'), fixturesAbsDir +
297-
'/nested-index/one/realpath-c'],
297+
'/nested-index/one/realpath-c'],
298298
[fixturesAbsDir + '/nested-index/one/realpath-c', fixturesAbsDir +
299-
'/nested-index/two/realpath-c'],
299+
'/nested-index/two/realpath-c'],
300300
[fixturesAbsDir + '/nested-index/two/realpath-c',
301-
'../../../' + common.tmpDirName + '/cycles/root.js']
301+
common.tmpDir + '/cycles/root.js']
302302
].forEach(function(t) {
303303
try { fs.unlinkSync(t[0]); } catch (e) {}
304304
fs.symlinkSync(t[1], t[0]);

test/parallel/test-fs-symlink-dir-junction-relative.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var expected_tests = 2;
1111
var linkPath1 = path.join(common.tmpDir, 'junction1');
1212
var linkPath2 = path.join(common.tmpDir, 'junction2');
1313
var linkTarget = path.join(common.fixturesDir);
14-
var linkData = '../fixtures';
14+
var linkData = path.join(common.fixturesDir);
1515

1616
common.refreshTmpDir();
1717

@@ -42,4 +42,3 @@ function verifyLink(linkPath) {
4242
process.on('exit', function() {
4343
assert.equal(completed, expected_tests);
4444
});
45-

0 commit comments

Comments
 (0)