Fetching contributors…
Cannot retrieve contributors at this time
93 lines (47 sloc) 4.1 KB

Compatibility and Features

Browser Testing

A classic example of browser testing with blanket coverage can be found in /test/lib-tests. This is blanket covering the blanket code (eating our own dog food).

Blanket can be run in any modern browser (Chrome, FF, Safari, IE9+), but will fail in IE8 or lower. You may need to use es5-shim to get it working in those environments. If you feel Blanket should support IE8, please let me know in the Issue Tracker.

Node testing

Node testing can be seen in /test/test-node. These are blanket's own node based tests.


If you already use RequireJS in your test runner, it's no problem, blanket will work around it. See an example in /test/requirejs

Mocha in the browser

Mocha can be run in the browser, and blanket seamlessly integrates with it. All you need to do is reference the mocha adapter when you reference the blanket script, and the rest is done for you.

Check out an example in /test/mocha-browser


Blanket comes with QUnit support by default, but Jasmine (or any other test runner) can be supported using an adapter (or a custom build!).

An example of Jasmine support can be seen in /test/jasmine


Backbone, or any external library, doesn't have any effect on blanket. The Backbone Koans test suite (by Addy Osmani) illustrates the compatibility.

CoffeeScript in the browser

If your test runner tests source files written in coffee script, blanket still has you covered. Using a custom loader, coffeescript files are compiled, instrumented, and tested.

See coffeescript support in /test/coffee_script

CoffeeScript in node

If your mocha tests use coffee script source files, blanket still has you covered.

See an example in /test/test-node/.

Custom Reporter

You can easily create your own reporters for blanket. See a frivolously simple example in /test/custom-reporter

Branch Tracking

Blanket can track untouched branches. You can view a simple example in /test/branchTracking


Blanket can be used with the YUI framework. A custom adapter is required, and the TestRunner code needs to be wrapped in a blanket call. You can view an example in /test/yui.


Blanket can be used live to determine how much extraneous code you have on a page. It displays a live coverage percentage. As you navigate the site the coverage percentage should increase and you can view full results to see untouched code blocks. See an example using the Backbone Todos App in /test/usage.

How much jQuery does Bootstrap use?

You can cover dependencies of your source files to see what percentage of a certain library you use.

You can see this in action by viewing /test/bootstrap and seeing that Twitter Bootstrap uses almost 50% of jQuery code!