Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

karma-coverage must be installed in order to run code coverage #426

Open
sysmat opened this issue Nov 12, 2020 · 3 comments
Open

karma-coverage must be installed in order to run code coverage #426

sysmat opened this issue Nov 12, 2020 · 3 comments

Comments

@sysmat
Copy link

sysmat commented Nov 12, 2020

"karma": "^5.2.3",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "^2.0.3",
    "karma-jasmine": "~4.0.1",
    "karma-jasmine-html-reporter": "^1.5.4",
    "karma-spec-reporter": "0.0.32",

and installed

@dkimmich-onventis
Copy link

I had the same issue after updating my project to Angular 11, and trying to set up karma-coverage.

Fixed it by adding the kjhtml reporter instead of the coverage reporter:

reporters: ['progress', 'kjhtml'],

Next time when you open such an issue, please give more context. With the little information you provided it is nearly impossible to help you.

@sysmat
Copy link
Author

sysmat commented Nov 12, 2020

The same problem with angular 11

@johnsonlin
Copy link

Make sure you have it in plugins section:
karma.conf.js

    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage'),  <--- add this line
      require('@angular-devkit/build-angular/plugins/karma'),
    ],

The official doc assumes that you know what you're doing and omits plugins section in the example I think.
https://github.com/karma-runner/karma-coverage#basic
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants