Browse Source

test: use realpath for NODE_TEST_DIR in common.js

If you don't specify NODE_TEST_DIR, common.tmpDir will resolve to the
realpath of `node/test`.

If you do specify NODE_TEST_DIR (with the environment variable or by
running or by running tools/test.py --test-dir=x), common.tmpDir (which
is resolved from testRoot) uses the symbolic path (doesn't resolve
symlinks). This uses fs.realpathSync() to fix that.

PR-URL: https://github.com/nodejs/node/pull/10723
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
v6.x
Gibson Fahnestock 8 years ago
committed by Myles Borins
parent
commit
0f3677dd5d
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 2
      test/README.md
  2. 2
      test/common.js

2
test/README.md

@ -373,7 +373,7 @@ Synchronous version of `spawnPwd`.
### tmpDir
* return [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)
Path to the 'tmp' directory.
The realpath of the 'tmp' directory.
### tmpDirName
* return [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)

2
test/common.js

@ -10,7 +10,7 @@ const util = require('util');
const Timer = process.binding('timer_wrap').Timer;
const testRoot = process.env.NODE_TEST_DIR ?
path.resolve(process.env.NODE_TEST_DIR) : __dirname;
fs.realpathSync(process.env.NODE_TEST_DIR) : __dirname;
exports.fixturesDir = path.join(__dirname, 'fixtures');
exports.tmpDirName = 'tmp';

Loading…
Cancel
Save