Category Archives: Angular CLI

How to Add a Test Coverage Report to an Angular CLI Project

Angular CLI has test coverage reporting somewhat built in.

First install the dependencies.

$ npm install karma karma-jasmine karma-chrome-launcher karma-jasmine-html-reporter karma-coverage-istanbul-reporter

Then run ng test.

$ ng test --code-coverage

Then run the server that shows you your report.

$ http-server -c-1 -o -p 9875 ./coverage

You should see something like this.