Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use outputStream instead of stdout for output file #4858

Merged
merged 2 commits into from
Feb 23, 2018
Merged
Changes from all commits
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
3 changes: 2 additions & 1 deletion packages/jest-cli/src/run_jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const processResults = (runResults, options) => {
const filePath = path.resolve(process.cwd(), outputFile);

fs.writeFileSync(filePath, JSON.stringify(formatTestResults(runResults)));
process.stdout.write(
options.outputStream.write(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only ended up changing it for the case when --json --outputFile and --useStderr are used at the same time. Changing it for --json --useStderr wihtout --outputFIle broke a lot of integration tests, which made me curious if that was even the expected behavior. That is why I left it the way it was.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense this way. Does it still fix the issue?

`Test results written to: ` +
`${path.relative(process.cwd(), filePath)}\n`,
);
Expand Down Expand Up @@ -222,6 +222,7 @@ export default (async function runJest({
isJSON: globalConfig.json,
onComplete,
outputFile: globalConfig.outputFile,
outputStream,
testResultsProcessor: globalConfig.testResultsProcessor,
});
});