Skip to content

Commit

Permalink
test: remove common.tmpDirName
Browse files Browse the repository at this point in the history
`common.tmpDirName` is used in only one test and can be replaced with
`path.basename(common.tmpDir)`.

PR-URL: #17266
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
  • Loading branch information
Trott authored and MylesBorins committed Dec 12, 2017
1 parent cc91a00 commit f1b26be
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
5 changes: 0 additions & 5 deletions test/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,11 +376,6 @@ Synchronous version of `spawnPwd`.

The realpath of the 'tmp' directory.

### tmpDirName
* return [&lt;String>]

Name of the temp directory used by tests.

## Countdown Module

The `Countdown` module provides a simple countdown mechanism for tests that
Expand Down
6 changes: 3 additions & 3 deletions test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ exports.fixturesDir = fixturesDir;

// Using a `.` prefixed name, which is the convention for "hidden" on POSIX,
// gets tools to ignore it by default or by simple rules, especially eslint.
exports.tmpDirName = '.tmp';
let tmpDirName = '.tmp';
// PORT should match the definition in test/testpy/__init__.py.
exports.PORT = +process.env.NODE_COMMON_PORT || 12346;
exports.isWindows = process.platform === 'win32';
Expand Down Expand Up @@ -165,9 +165,9 @@ exports.refreshTmpDir = function() {

if (process.env.TEST_THREAD_ID) {
exports.PORT += process.env.TEST_THREAD_ID * 100;
exports.tmpDirName += `.${process.env.TEST_THREAD_ID}`;
tmpDirName += `.${process.env.TEST_THREAD_ID}`;
}
exports.tmpDir = path.join(testRoot, exports.tmpDirName);
exports.tmpDir = path.join(testRoot, tmpDirName);

let opensslCli = null;
let inFreeBSDJail = null;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-fs-realpath.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function test_simple_relative_symlink(realpath, realpathSync, callback) {
const entry = `${tmpDir}/symlink`;
const expected = `${tmpDir}/cycles/root.js`;
[
[entry, `../${common.tmpDirName}/cycles/root.js`]
[entry, `../${path.basename(tmpDir)}/cycles/root.js`]
].forEach(function(t) {
try { fs.unlinkSync(t[0]); } catch (e) {}
console.log('fs.symlinkSync(%j, %j, %j)', t[1], t[0], 'file');
Expand Down

0 comments on commit f1b26be

Please sign in to comment.