How JavaScript Code Coverage Works - a podcast by Kent C. Dodds

from 2016-04-06T15:53:46

:: ::

Just a quick explanation of how tools instrument your JavaScript code to
record and report code coverage. Common tools:istanbul (http://npm.im/istanbul)
nyc (http://npm.im/nyc) with ava (http://npm.im/ava) are great for coverage of node-running tests (use jsdom (http://npm.im/jsdom) to mock a DOM like I do (http://kcd.im/react-ava-repo)).babel-plugin-__coverage__ (http://npm.im/babel-plugin-__coverage__)
karma-coverage (http://npm.im/karma-coverage) with karma (http://npm.im/karma) and the babel plugin are great for coverage of code when you want to run your tests in a browserisparta (http://npm.im/isparta) (no longer maintained, try the babel
plugin)You may also be interested in this video (https://youtu.be/P-1ZZkpEmQA) + this repo (https://github.com/kentcdodds/random-user-coverage) 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 (https://github.com/kentcdodds/es6-todomvc/blob/0c1b0afe31bad4713c51f6485cd616730e4ede8b/.babelrc)) and it should work great 👍I hope this is helpful!
See you on twitter (https://twitter.com/kentcdodds)!

Further episodes of 3 Minutes with Kent

Further podcasts by Kent C. Dodds

Website of Kent C. Dodds