Jest allows you to specify a coverage reporter in the package.json like so
{
...
"jest": {
"coverageDirectory": "./coverage",
"coverageReporters": ["json", "text", ...]
}
...
}
However, this only outputs the .json
summary to the coverage directory. It only prints the text version to the console. Is there a way to output the text version to a .txt
file in the coverage folder as well?
I've been referring to the docs here, which says that it is compatible with any of the Istanbul reporters. The text Istanbul reporter appears to have support for writing to a file. Is there any way to utilize it this?
text
coverageReporter is just an alias fortext-summary
which just goes to stdout. You can redirect it if you want, but it's an extra step and it might contain other noise:jest --coverage > coverage/coverage.txt
– Nadeen.txt
– Doughnut