Yuu need to import plugin with code plugin into plugins
require('karma-coverage-istanbul-reporter'),
Also use the code below to add the istanbul repeater property as shown below
coverageIstanbulReporter: { reports: ['html', 'lcovonly'], fixWebpackSourcePaths: true, // enforce percentage thresholds // anything under these percentages will cause karma to fail with an exit code of 1 if not running in watch mode thresholds: { emitWarning: false, // set to `true` to not fail the test command when thresholds are not met global: { // thresholds for all files statements: 80, lines: 80, branches: 80, functions: 80 }, each: { // thresholds per file statements: 80, lines: 80, branches: 80, functions: 80, overrides: {} } } },
The full configuration for karma.config.js should be lower:
// Karma configuration file, see link for more information // https://karma-runner.imtqy.com/0.13/config/configuration-file.html module.exports = function(config) { config.set({ basePath: '', frameworks: ['jasmine', '@angular/cli'], plugins: [ require('karma-jasmine'), require('karma-chrome-launcher'), require('karma-jasmine-html-reporter'), require('karma-coverage-istanbul-reporter'), require('@angular/cli/plugins/karma'), require('karma-htmlfile-reporter'), ], client: { clearContext: false // leave Jasmine Spec Runner output visible in browser }, coverageIstanbulReporter: { reports: ['html', 'lcovonly'], fixWebpackSourcePaths: true, // enforce percentage thresholds // anything under these percentages will cause karma to fail with an exit code of 1 if not running in watch mode thresholds: { emitWarning: false, // set to `true` to not fail the test command when thresholds are not met global: { // thresholds for all files statements: 80, lines: 80, branches: 80, functions: 80 }, each: { // thresholds per file statements: 80, lines: 80, branches: 80, functions: 80, overrides: {} } } }, angularCli: { environment: 'dev' }, // reporters: config.angularCli && config.angularCli.codeCoverage ? ['spec', 'karma-remap-istanbul'] : ['spec'], // reporters: ['mocha'], reporters: ['progress', 'html', 'kjhtml'], htmlReporter: { outputFile: 'testreports/report.html', // Optional pageTitle: 'Rest Reports', subPageTitle: 'Suite-wise report ', groupSuites: true, useCompactStyle: true, useLegacyStyle: false }, port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, browsers: ['Chrome'], singleRun: false }); };