From 0f3677dd5d3875bde759dd3f2821e4c40099f53e Mon Sep 17 00:00:00 2001 From: Gibson Fahnestock Date: Tue, 10 Jan 2017 13:43:08 +0000 Subject: [PATCH] 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 Reviewed-By: James M Snell Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Michael Dawson --- test/README.md | 2 +- test/common.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/README.md b/test/README.md index dd680a82b6174e..0e8c13235da349 100644 --- a/test/README.md +++ b/test/README.md @@ -373,7 +373,7 @@ Synchronous version of `spawnPwd`. ### tmpDir * return [<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 [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) diff --git a/test/common.js b/test/common.js index 351e3673d14b02..b4f55d94d7d6b1 100644 --- a/test/common.js +++ b/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';