3 Minutes With Kent

How JavaScript Code Coverage Works

Informações:

Sinopse

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 browser isparta (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/0c1b0afe31bad4713c51f