react-redux-starter-kit icon indicating copy to clipboard operation
react-redux-starter-kit copied to clipboard

How to read coverage reports?

Open superlin opened this issue 10 years ago • 7 comments

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`

superlin avatar Apr 03 '16 04:04 superlin

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

SteveHoggNZ avatar Apr 03 '16 04:04 SteveHoggNZ

npm i -g http-server

and cd ./coverage && http-server

ralyodio avatar Apr 03 '16 05:04 ralyodio

Thanks a lot, @SteveHoggNZ @chovy

superlin avatar Apr 03 '16 06:04 superlin

you could probably add a script for that in package.json

"show-coverage": "cd ./coverage && http-server"

ralyodio avatar Apr 03 '16 07:04 ralyodio

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.

dvdzkwsk avatar Apr 05 '16 21:04 dvdzkwsk

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 :).

dvdzkwsk avatar Apr 06 '16 12:04 dvdzkwsk

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.

ghost avatar Jun 06 '17 21:06 ghost