Update karma coverage reporting for use in Angular 11
If you upgraded to Angular 11 recently, you might have noticed that karma-coverage-istanbul-reporter
has been deprecated.
It can simply be replaced with karma-coverage
and by changing some things in karma.conf.js
.
npm uninstall karma-coverage-istanbul-report
npm install karma karma-coverage
Update karma.conf.js
:
- by removing require
require('karma-coverage-istanbul-report')
and includingrequire('karma-coverage')
; - changing
coverageIstanbulReporter
tocoverageReporter
; - and changing the
reports
parameter toreporters
.
As reference I refer to the karma.conf.js
template within Angular 11: https://github.com/angular/angular-cli/blob/v11.0.0/packages/schematics/angular/application/files/karma.conf.js.template.