Seamless javascript code coverage

Blanket.js is an easy to install, easy to configure, and easy to use JavaScript code coverage library that works both in-browser and with nodejs.

Try it today!


See it in action!

Check out the Backbone-koans-qunit test suite powered by blanket.js.

Download

The only file you need is blanket.js. Download the library and reference it in your test runner.

<script src="blanket.js"></script>

Configure

Add a data-cover attribute to the script reference of each file you want covered

<script src="my-library.js" data-cover></script>

Enjoy

Run your test as usual, and the coverage details will automatically be reported.



NodeJS (Powered by Mocha)

Install from npm.

npm install blanket

Make sure you require Blanket before you require or run any of the code you want covered

require("blanket")({ /* optional options */ }),  require("src/myscripttotest");

Run your tests using mocha and take advantage of the json-cov and html-cov reporters to output the coverage results.



Support

We currently support Qunit, Mocha and Jasmine. An adapter API exists for supporting other test runners.

qunit qunit qunit