Just a quick explanation of how tools instrument your JavaScript code to record and report code coverage. Common tools:
istanbul
nyc
with ava
are great for coverage of node-running tests (use jsdom
to mock a DOM like I do).babel-plugin-__coverage__
karma-coverage
with karma
and the babel plugin are great for coverage of code when you want to run your tests in a browserisparta
(no longer maintained, try the babel
plugin)You may also be interested in this video + this repo where I go through setting up code coverage with ES6, Webpack, and Karma. Just replace where I use isparta
with using babel-plugin-__coverage__
(like this) and it should work great 👍
I hope this is helpful!
See you on twitter!