3 Minutes with Kent

How JavaScript Code Coverage Works


Listen Later

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 browser
  • isparta (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!

    ...more
    View all episodesView all episodes
    Download on the App Store

    3 Minutes with KentBy Kent C. Dodds

    • 5
    • 5
    • 5
    • 5
    • 5

    5

    4 ratings