Code coverage

It's always a good practice to know about code coverage in your project. In very simple words, code coverage can be thought as the code which is tested. A higher code coverage means that the code written is carefully tested and leads to a minimal chance of occurrence of bugs. A code with the lower coverage can lead to frequent bugs since it was not properly tested.

JsTestDriver has coverage plugin available to generate a report for your project. In the jsTestDriver.conf file, we need to add coverage plugin to generate the report:

server: http://localhost:9880 load: - lib/jasmine-1.1.0/jasmine.js - lib/adapter/JasmineAdapter.js - lib/jquery.1.11.3.min.js - src/*.js test: - src-test/*.js plugin: - name: "coverage" jar: "lib/coverage-1.3.5.jar" ...

Get Test-Driven JavaScript Development 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.