Code Coverage

Learn how to use Karma to report test coverage.

The Karma test runner allows us to generate a code coverage report that is useful to indicate areas of the code that haven’t been tested. Code coverage does not guarantee that we have tested every path through the application. However, it’s helpful to highlight classes or lines of application code that are not executed at all during a test run.

How to calculate test coverage

Running a coverage report with Karma is easy. When we call the ng test command from our terminal, we simply add the ...