[Bug]: Using --outputFile --json suppresses CLI coverage output
See original GitHub issueVersion
27.5.1
Steps to reproduce
- Clone https://github.com/wilhen01/jest-outputfile-bug-repro
npm install
npm run test-outputfile
to see output using --outputFile --jsonnpm run test-no-outputfile
to see output without those flags
Expected behavior
With code coverage configured. via jest.config.js
I would expect to see CLI coverage output, regardless of the use of --outputFile --json
e.g.
PASS test/hello.test.ts
hello world function
✓ returns the correct string (1 ms)
----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files | 100 | 100 | 100 | 100 |
index.ts | 100 | 100 | 100 | 100 |
----------|---------|----------|---------|---------|-------------------
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 1.83 s, estimated 2 s
Ran all test suites.
Actual behavior
When using --outputFile --json
the CLI coverage output is suppressed. Regular test output on the command line remains.
e.g.
❯ npm run test-outputfile
> jest-outputfile-bug-repro@1.0.0 test-outputfile
> jest --outputFile test-results.json --json
PASS test/hello.test.ts
hello world function
✓ returns the correct string (1 ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 1.935 s, estimated 3 s
Ran all test suites.
Test results written to: test-results.json
Additional context
No response
Environment
System:
OS: macOS 12.2
CPU: (10) x64 Apple M1 Pro
Binaries:
Node: 14.19.0 - ~/.nvm/versions/node/v14.19.0/bin/node
npm: 8.5.0 - ~/.nvm/versions/node/v14.19.0/bin/npm
npmPackages:
jest: latest => 27.5.1
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:19
Top Results From Across the Web
Jest ---outputFile removes CLI coverage output - Stack Overflow
With --outputFile specified code coverage is still run and results are put in the coverage directory, but the CLI output doesn't include ...
Read more >Clang-Tidy — Extra Clang Tools 16.0.0git documentation
Some clang-tidy checks provide a check-specific way to silence the diagnostics, e.g. bugprone-use-after-move can be silenced by re-initializing the variable ...
Read more >Changelog - Node Tap
Do not limit the --coverage-report option to just the built-in reporters. ... Friendlier output on invalid argument assertion failures from the tap CLI....
Read more >TSConfig Reference - Docs on every TSConfig option
It has no interaction with the include , exclude , or files tsconfig.json settings. Note that TypeScript will never write an output file...
Read more >Release notes & updates – Azure CLI - Microsoft Learn
June 4, 2019. Version 2.0.66. Core. Fixed bug where commands fail if --output yaml is used with --query ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
While the PR is not merged, an workarround to get the same file can be:
my-results-processor.js
There is #12536 fwiw