dvdzkwsk / react-redux-starter-kit

Get started with React, Redux, and React-Router.
MIT License
10.28k stars 2.2k forks source link

Adding code coverage using Istanbul #1307

Open sproogen opened 7 years ago

sproogen commented 7 years ago

Really useful starter kit, but I had noticed code coverage had been disabled in the latest version and I ran into a number of issues trying to get it included again.

In the end I managed to get it working with karma-coverage-istanbul-reporter and istanbul-instrumenter-loader.

I'm not sure if this is the perfect solution but thought I would pull request this solution back in.

codecov-io commented 7 years ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@c1c4e8c). Click here to learn what that means. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1307   +/-   ##
=========================================
  Coverage          ?   64.13%           
=========================================
  Files             ?       13           
  Lines             ?       92           
  Branches          ?        0           
=========================================
  Hits              ?       59           
  Misses            ?       33           
  Partials          ?        0

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c1c4e8c...75df3d4. Read the comment docs.

prescottprue commented 7 years ago

When implementing it worked great, but I got the following deprecation message:

deprecation warning from loader utils

To keep this warning from appearing I needed to update istanbul-instrumenter-loader to v3.0.0-rc.1 (can be installed using npm i --save-dev istanbul-instrumenter-loader@beta). It seems like everything beyond v3.0.0-beta.1 should work since it was fixed in issue #61 of istanbul-instrumenter-loader.

Note that this was just to fix a deprecation warning from loader-utils, so if you don't mind getting that warning, then the stable version is just fine.

sproogen commented 7 years ago

That's good to know, I couldn't work out how to remove the deprecation messages.

Hopefully they will release v3.0.0 of the istanbul-instrumenter-loader soon then.

Thanks