gotwarlost / istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
8.7k stars 786 forks source link

Open Coverage File Automatically on Test Command? #939

Closed tracyalison11 closed 3 years ago

tracyalison11 commented 3 years ago

Is there any configuration setting that serves or pops open the coverage file in a browser window? I am looking for a solution to have it open up on command instead of digging for the file and opening static html. Thanks so much for any direction on this and thanks for writing this package! Huge help to our team.

mannyluvstacos commented 3 years ago

Hey there @tracyalison11! If you're using npm or yarn, would calling

test: [incantations of all the testing and covering] && open coverage/lcov-report/index.html

not work?

Or even have a script such as:

"openCoverage": "open coverage/lcov-report/index.html"

And calling npm run openCoverage or yarn openCoverage work?

tracyalison11 commented 3 years ago

Thank you so much! Implemented this and it works!