Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
continue to putput json to cwd
  • Loading branch information
SimenB committed Jan 14, 2019
commit a9e9414f3de3355a626cc35c4df135bab115acab
8 changes: 4 additions & 4 deletions packages/jest-cli/src/runJest.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type TestWatcher from './TestWatcher';
import micromatch from 'micromatch';
import chalk from 'chalk';
import path from 'path';
import {sync as realpath} from 'realpath-native';
import {Console, formatTestResults} from 'jest-util';
import exit from 'exit';
import fs from 'graceful-fs';
Expand Down Expand Up @@ -73,7 +74,6 @@ const processResults = (runResults, options) => {
onComplete,
outputStream,
testResultsProcessor,
rootDir,
collectHandles,
} = options;

Expand All @@ -89,11 +89,12 @@ const processResults = (runResults, options) => {
}
if (isJSON) {
if (outputFile) {
const filePath = path.resolve(rootDir, outputFile);
const cwd = realpath(process.cwd());
const filePath = path.resolve(cwd, outputFile);

fs.writeFileSync(filePath, JSON.stringify(formatTestResults(runResults)));
outputStream.write(
`Test results written to: ${path.relative(rootDir, filePath)}\n`,
`Test results written to: ${path.relative(cwd, filePath)}\n`,
);
} else {
process.stdout.write(JSON.stringify(formatTestResults(runResults)));
Expand Down Expand Up @@ -274,7 +275,6 @@ export default (async function runJest({
onComplete,
outputFile: globalConfig.outputFile,
outputStream,
rootDir: globalConfig.rootDir,
testResultsProcessor: globalConfig.testResultsProcessor,
});
});