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

"Can not load "coverage", it is not registered!" error when running #59

Closed
apond opened this Issue Feb 10, 2014 · 21 comments

Comments

Projects
None yet
@apond
Copy link

apond commented Feb 10, 2014

I install karma-coverage like this:
npm install karma-coverage --save-dev

I have a package file that contains this:
"devDependencies": {
"karma": "0.10.2",
"karma-coverage": "0.1.5",
"karma-junit-reporter": "0.1.0",
"karma-jasmine": "0.1.3",
"karma-chrome-launcher": "0.1.0",
"karma-ie-launcher": "0.1.1",
"karma-safari-launcher": "0.1.1",
"karma-firefox-launcher": "0.1.0"
},

And a config file that looks contains this:
// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
reporters: ['dots', 'junit', 'coverage'],

preprocessors: {
  // source files, that you wanna generate coverage for
  // do not include tests or libraries
  // (these files will be instrumented by Istanbul)
  'jstarget/**/*.js': ['coverage']
},

// configure the coverage reporter
coverageReporter: {
  type : 'html',
  dir : 'coverage/'
},

And I get an error that looks like this:
WARN [reporter]: Can not load "coverage", it is not registered!
Perhaps you are missing some plugin?

What do I need to do?

@apond

This comment has been minimized.

Copy link

apond commented Feb 10, 2014

I forgot to add karma-coverage to the list of plugins. This should be added to the sample config in the readme.

Antonio-Laguna pushed a commit to Antonio-Laguna/karma-coverage that referenced this issue Mar 10, 2014

@vojtajina

This comment has been minimized.

Copy link
Contributor

vojtajina commented Mar 16, 2014

@apond what is your set up look like?

The recommended way is to install karma and all the plugins in your project (not global). Then, Karma automatically loads all the plugins (karma-*).

@vojtajina vojtajina closed this Mar 16, 2014

@apond

This comment has been minimized.

Copy link

apond commented Mar 17, 2014

@vojtajina All of my setup is shown above. I have installed karma and the plugins. Without the plugins listed in the config file this doesn't work. What is the alternative?

@vojtajina

This comment has been minimized.

Copy link
Contributor

vojtajina commented Mar 22, 2014

You can list the plugins, but it should work without it. By default, Karma loads karma-* modules that are siblings to karma module.

@ryoia

This comment has been minimized.

Copy link

ryoia commented Jul 9, 2015

I am having the same problem currently, it worked fine yesterday, but now it says can not load 'webpack'/'coverage'/'sourcemap' did you forget to install it? i have them in the devDep., and did npm i already. Also having 'Perhaps you are missing some plugin' for those 3 as well.

@davidpricedev

This comment has been minimized.

Copy link

davidpricedev commented Aug 5, 2015

I had this problem as well. I was able to get things working once I deleted all the global karma packages and reinstalled karma-cli as the only global (karma-related) package.

@ryoia

This comment has been minimized.

Copy link

ryoia commented Aug 5, 2015

I got it working by doing the same thing, thanks for replying!

@simon-nguyen

This comment has been minimized.

Copy link

simon-nguyen commented Oct 6, 2015

@davidpricedev @ryoia I just got the same issue working with webpack, and when I run karma start, it said "cannot load webpack, source-map" I did as you suggested and now it works perfectly. Thanks.

@ryoia

This comment has been minimized.

Copy link

ryoia commented Oct 6, 2015

awesome @simon-nguyen !

@eelogic

This comment has been minimized.

Copy link

eelogic commented Nov 26, 2015

I ran karma with gulp and got the same issue, fixed as @apond mentioned:
plugins: [
'karma-webpack', 'karma-coverage'
]

@ekkis

This comment has been minimized.

Copy link

ekkis commented Jan 1, 2016

I've found that if I declare the plugins option with any values, it fails to load all the karma-* modules. if I remove it altogether then it works fine. I'm not sure why I would ever want to use plugins in that case, since I could only be declaring plugins that would be loaded anyway, without the declaration

@brutalcrozt

This comment has been minimized.

Copy link

brutalcrozt commented Feb 3, 2016

I still facing that error with out explicitly specify karma-coverage as plugins.
as far as i remember i install karma-cli and karma-coverage globally.
IMO , should update the README.md

@dignifiedquire

This comment has been minimized.

Copy link
Member

dignifiedquire commented Feb 3, 2016

plugins need to be installed locally as devdependencies as stated in the readme then the auto loading works as expected

@brutalcrozt

This comment has been minimized.

Copy link

brutalcrozt commented Feb 3, 2016

@dignifiedquire I also install it locally, i just notice that it work after i explicitly specify karma-coverage as plugins. Before that still yell coverage not registered.

@julmot

This comment has been minimized.

Copy link

julmot commented Mar 30, 2016

@dignifiedquire I can confirm the behavior of @brutalcrozt.

@deepakkaithwas

This comment has been minimized.

Copy link

deepakkaithwas commented Jul 20, 2016

I got the same [WARN] because the plugin 'karma-coverage' was not defined inside the plugins of the config, try to see if adding it fixes your warning, not sure if it will fix your full problem.

plugins: [
  'karma-jasmine',
  'karma-coverage'
],
@MPV

This comment has been minimized.

Copy link

MPV commented Jul 26, 2016

For me, none of these suggestions help:

  • Adding plugins to karma.conf.js with all Karma plugins I use.
  • Not having plugins defined in karma.conf.js.

(I'm on v1.0.0 and I have all my karma plugins in package.json as dependencies)

@nginnever nginnever referenced this issue Aug 9, 2016

Merged

feat/ipfs.files.get #337

0 of 1 task complete
@jennet

This comment has been minimized.

Copy link

jennet commented May 4, 2017

I had this problem on the build server (team city) and it turned out to be because I'd installed karma globally, instead of karma-cli (which is the only one needed globally on the build server)

I have no plugins defined in config, they are loaded automatically via their naming convention.

Solution found here

@bogdan-panteleev

This comment has been minimized.

Copy link

bogdan-panteleev commented Sep 23, 2018

@davidpricedev , Thanks a lot. It helped)

@alandroid

This comment has been minimized.

Copy link

alandroid commented Jan 4, 2019

I have a similar issue but may be specific to the reporter:
dgarlitt/karma-nyan-reporter#43

@johnjbarton

This comment has been minimized.

Copy link
Contributor

johnjbarton commented Jan 4, 2019

This error message means the npm module containing the registration entries did not execute. So the module was not require-d or it failed during load. Most plugins are require-d but listing them in the plugin section of the config.

Using logLevel debug may help:
http://karma-runner.github.io/3.0/intro/troubleshooting.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment