Measure Code Coverage

Looking at the tests and the code designed with them, the test-to-code ratio we discussed in the previous chapters has held here too—we have a 3:1 ratio of tests to the AngularJS controller and server code.

The package.json file already contains the script to create the coverage report. Simply run the command

npm run-script cover-client

and take a look at the generated coverage report by opening the file index.html under the subdirectory coverage.

images/testangular/coverage.png

The report shows coverage for the controller and the server we wrote in this chapter along with the files created in the previous chapter. Click on the links in the report to ...

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.