Skip to content

Latest commit

 

History

History
60 lines (43 loc) · 1.41 KB

README.md

File metadata and controls

60 lines (43 loc) · 1.41 KB

Jest Outputfile Bug Repro

Simple reproduction to show that the use of --outputfile --json affects coverage output on the command line.

Setup

npm install

Test with outputfile

npm run test-outputfile

Returns output:

❯ 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

Test without outputfile

npm run test-no-outputfile

Returns output:

❯ npm run test-no-outputfile

> [email protected] test-no-outputfile
> jest

 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.