Measure Server-Side Code Coverage

Code coverage reports can be quite valuable. A code coverage report quickly indicates lines of code not touched by any tests. Istanbul is a pretty good JavaScript tool to create coverage reports. It instruments code, and keeps track of whether each line of code is called and how many times. It gives both line coverage and branch coverage.

The actual code coverage numbers, like 80 percent or 90 percent, are not that important. These numbers are like the cholesterol numbers used to monitor health—a poor value is a cause for concern, but a good value doesn’t receive any celebrations. More than the number, a peek at the lines not covered by the tests is more valuable. Also, ensure that the coverage numbers never ...

Get Test-Driving JavaScript Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.