Measure Client-Side Code Coverage

We used Istanbul to measure the coverage of server-side code. The same tool can be used for client side as well. The package.json file we used for the client-side project in the workspace already had the necessary tools listed, Istanbul and the necessary Karma plugin. Also, the test command already specified that the coverage report be generated with each test run. All we have to do is take a peek at the coverage report file—well, almost. We need a small tweak to the karma.conf.js file in the tdd/client/palindrome directory:

​ ​// preprocess matching files before serving them to the browser​
​ ​// available preprocessors:​
​ ​// https://npmjs.org/browse/keyword/karma-preprocessor ...

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.