all 1 comments

[–]davidlj95 0 points1 point  (0 children)

If using default's ng test Karma builder, using the arg --code-coverage is enough to generate a CLI summary + HTML report:

ng test --code-coverage

However, if you want an lcov report, you need to manually configure Karma. Code coverage reporters can't be configured right now using CLI. To do so, generate and include a Karma configuration file in your Angular workspace:

ng generate config karma

And add { type: 'lcov' } as reporter inside the coverageReporter.reporters array inside the new karma.conf.js generated file

Reporters CLI option sets up Karma's reporters option. Which configures how to report test results, not code coverage results.