• page

Code Coverage funcunit.coverage


This guide will show you how to determine the code coverage of your FuncUnit tests. Code coverage is tracked and calculated by [steal.instrument].

Basic reporting

To turn on code coverage for any funcunit or qunit test, add the following snippet to the end of your stealconfig.js file:

steal('steal/instrument', function(instrument){
        ignores: ["jquery","can","funcunit","steal",

After the test completes, a coverage report will be shown:

To see which blocks of a file are covered and which are not, click a file's name:

The numbers on the left are how many times each line has been run.

Ignoring files

When you're determining code coverage, you won't want to include non application code in your coverage statistics. JMVC and other third party code will skew coverage statistics.

To ignore files when running from commandline, modify the ignores property shown in the snippet above. Any string in this array will be matched against files. Matches will be ignored. * is used as an asterisk. *_test.js will ignore any file ending in _test.js.