visionmedia/mocha — pull request #537 by jonasacres (2012-08-10 02:12:28+00:00)
Title: Add conditional ignore support via //#JSCOVERAGE_IF

JSCoverage has support for doing conditional measurement of lines by adding //#JSCOVERAGE_IF condition to the start of a line. If condition evaluates to false, it is expected that the lines enclosed by //#JSCOVERAGE_IF and //#JSCOVERAGE_ENDIF will not be counted towards SLOC, hits or misses, regardless of whether the enclosed lines are executed or not.

Although node-jscoverage generates instrumentation for this, json-cov does not factor this into its analysis, nor does html-cov have the capability to use those statistics in rendering the HTML file.

This pull request causes json-cov to track conditionally ignored code. Objects representing an ignored line have "ignore":true; other lines omit the ignore property, to avoid adding unwanted verbosity. Code which is ignored does not count towards SLOC, hits or misses; code which is conditionally enabled is counted towards statistics as normal. A "skips" tally is added to overall statistics.

html-cov's templates are also updated to highlight conditionally ignored code in yellow. The templates do not make use of the skipped line statistics.

![Example](http://s10.postimage.org/l4ipospvt/conditional_ignore.png)