Skip to content Skip to sidebar Skip to footer

Ng Test --code-coverage Not Printing Coverage Details

When I run the tests using ng test --code-coverage I get the code coverage as unknown, not sure what might be going wrong. Any help here is appreciated.

Solution 1:

I ran into the same problem and fixed it by making sure the "sourceRoot" property in the angular.json is set to the root folder for the project's source files.

The ng cli uses the files in "sourceRoot" to compute coverage.

It doesn't seem to do anything else with sourceRoot for tests, so the tests run and pass, but coverage doesn't work.

Post a Comment for "Ng Test --code-coverage Not Printing Coverage Details"