6

I have an Angular app and I'm giving testing a go but it's a nightmare to find where the coverage is needed.

the output shows the following:

=============================== Coverage summary ===============================      
Statements   : 91.67% ( 22/24 )
Branches     : 75% ( 3/4 )
Functions    : 75% ( 3/4 )
Lines        : 90.48% ( 19/21 )
================================================================================ 

Is there a way to see where these statements, branches, functions and lines are that are not covered?

e.g. some output that says

Statements:
1. file: some/file/name.js line:03
2. file: some/file/name.js line:06

Is that possible?

Thanks

Liam Clarke
  • 243
  • 4
  • 13

1 Answers1

7

Angular CLI creates code coverage reports when using the following command (see Enable code coverage reports).

ng test --code-coverage

When the tests are complete, the command creates a new /coverage folder in the project or it overwrites its content if it existed before. Open the index.html file inside the /coverage folder to see a report with your source code and code coverage values.

uminder
  • 23,831
  • 5
  • 37
  • 72