-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Open
Labels
Description
Version
27.5.1
Steps to reproduce
- Clone https://github.com/wilhen01/jest-outputfile-bug-repro
npm installnpm run test-outputfileto see output using --outputFile --jsonnpm run test-no-outputfileto 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
> [email protected] 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.1ibratoev, calpa, sghsri, ibm-pirada, bholtbholt and 1 more