Skip to content

Commit c5ca7c8

Browse files
author
Michael Johns
committed
Replace <rootDir> prior to path.join().
This allows outputDirectory to be formatted like <rootDir>/../some/dir. In that case, path.join() assumes the .. cancels out the <rootDir>, which seems entirely reasonable. Unfortunately, it means the final value is some/dir, and that ends up rooted at process.cwd(), which doesn't always match <rootDir>. Handling the <rootDir> replacement first allevaites this problem.
1 parent 46bc2c9 commit c5ca7c8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

utils/getOutputPath.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ module.exports = (options, jestRootDir) => {
77
if (!output) {
88
// Set output to use new outputDirectory and fallback on original output
99
const outputName = (options.uniqueOutputName === 'true') ? getOptions.getUniqueOutputName() : options.outputName
10-
output = path.join(options.outputDirectory, outputName);
10+
output = getOptions.replaceRootDirInOutput(jestRootDir, options.outputDirectory);
11+
const finalOutput = path.join(output, outputName);
12+
return finalOutput;
1113
}
1214

1315
const finalOutput = getOptions.replaceRootDirInOutput(jestRootDir, output);

0 commit comments

Comments
 (0)