How to read coverage reports?
I got the information below, and no reports had shown.
$ npm run codecov
> [email protected] codecov /Users/superlin/github/react-redux-starter-kit
> cat coverage/*/lcov.info | codecov
_____ _
/ ____| | |
| | ___ __| | ___ ___ _____ __
| | / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| | __/ (_| (_) \ V /
\_____\___/ \__,_|\___|\___\___/ \_/
v1.0.1
==> Detecting CI Provider
No CI Detected. Using git/mercurial
==> Configuration:
Endpoint: https://codecov.io
{ commit: '8fe1d106390e57b672e79c119c094de6a5e42088',
branch: 'master',
package: 'node-v1.0.1' }
==> Building file structure
==> Generating gcov reports (skip via --disable=gcov)
$ find . -type f -name '*.gcno' -exec gcov {} +
==> Scanning for reports
+ ./coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/lcov.info
==> Uploading reports
HTTP 400
Please provide the repository token to upload reports via `-t :repository-token`
See https://github.com/davezuko/react-redux-starter-kit#usage
You should just use:
npm test
The results are output as HTML into the ./coverage directory with a name that matches the test browser e.g. this is 'coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/lcov-report' for me.
I usually use serve to view them e.g.
serve '$(find coverage/ -type d -name lcov-report)' --port 3001
Then go to http://localhost:3001 in your browser
npm i -g http-server
and cd ./coverage && http-server
Thanks a lot, @SteveHoggNZ @chovy
you could probably add a script for that in package.json
"show-coverage": "cd ./coverage && http-server"
Honestly I'd like to avoid adding another dependency for this when it's easy enough to just drop the generated report in your browser. Perhaps we could just serve it up with Koa, but even that seems unnecessary, even if it isn't difficult.
Closing since as @SteveHoggNZ mentions test is the command to use, coverage is just for CI/automated reporting. I will update the README later today to explain how to access coverage reports so it's a bit more clear, so we'll at least get something out of this :).
Did this fall off the list? I don't see a coverage directory after running the test task or any documentation about it in the README.