Jest: Provide a local file link to coverage files after CLI output chart?

Created on 7 Mar 2018  路  3Comments  路  Source: facebook/jest

Do you want to request a _feature_ or report a _bug_?

Request a feature

What is the current behavior?

After running jest --coverage, we get a lovely ASCII chart in the console from istanbul.
Since introducing Jest to a team, I've been asked infrequently if there's a way to see more detailed information. We have it in our docs to look open ./coverage/lcov-report/index.html for more, but you know how people are with docs.

What is the expected behavior?

Can there be an added "Open (path-to-index) for more details" to better surface this?

------------------|----------|----------|----------|----------|----------------|
File              |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
------------------|----------|----------|----------|----------|----------------|
All files         |      100 |       70 |      100 |      100 |                |
  src             |      100 |       70 |      100 |      100 |                |
  ...
------------------|----------|----------|----------|----------|----------------|

Open ./coverage/lcov-report/index.html for more details.

Most helpful comment

@JoshuaKGoldberg you can solve this in userland with

jest --coverage && echo "\n\nOpen ./coverage/lcov-report/index.html for coverage details"

Or to automatically open the report after the run:

jest --coverage && open ./coverage/lcov-report/index.html 

All 3 comments

@JoshuaKGoldberg you can solve this in userland with

jest --coverage && echo "\n\nOpen ./coverage/lcov-report/index.html for coverage details"

Or to automatically open the report after the run:

jest --coverage && open ./coverage/lcov-report/index.html 

We could add a note, but that would be very dependent on the reporters used, so I'm not sure about it, definitely a burden to maintain

The echo solution works for me. Thanks! :)

Was this page helpful?
0 / 5 - 0 ratings