Skip to content

Commit

Permalink
test: don't use cwd for relative path
Browse files Browse the repository at this point in the history
With the introduction of temporary paths in the test runner
realpath tests would bail in scenarios where the temporary folder
wasn't in the same directory as the source code.

PR-URL: #4477
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
jbergstroem authored and Myles Borins committed Jan 19, 2016
1 parent 33e72e1 commit 46d8c93
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions test/parallel/test-fs-realpath.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,10 @@ function test_relative_input_cwd(callback) {
return runNextTest();
}

// we need to get the relative path to the tmp dir from cwd.
// When the test runner is running it, that will be .../node/test
// but it's more common to run `./node test/.../`, so detect it here.
// we need to calculate the relative path to the tmp dir from cwd
var entrydir = process.cwd();
var entry = common.tmpDir.substr(entrydir.length + 1) + '/cycles/realpath-3a';
var entry = path.relative(entrydir,
path.join(common.tmpDir + '/cycles/realpath-3a'));
var expected = common.tmpDir + '/cycles/root.js';
[
[entry, '../cycles/realpath-3b'],
Expand Down

0 comments on commit 46d8c93

Please sign in to comment.