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

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

Closed
apond opened this issue Feb 10, 2014 · 23 comments
Closed

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

apond opened this issue Feb 10, 2014 · 23 comments

Comments

@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
Copy link
Author

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
Copy link
Contributor

@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-*).

@apond
Copy link
Author

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
Copy link
Contributor

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

@ryoia
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
Copy link

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
Copy link

ryoia commented Aug 5, 2015

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

@simon-nguyen
Copy link

@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
Copy link

ryoia commented Oct 6, 2015

awesome @simon-nguyen !

@eelogic
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
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

@sukrosono
Copy link

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
Copy link
Member

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

@sukrosono
Copy link

@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.

@julkue
Copy link

julkue commented Mar 30, 2016

@dignifiedquire I can confirm the behavior of @brutalcrozt.

@deepakkaithwas
Copy link

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
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)

@jennet
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
Copy link

@davidpricedev , Thanks a lot. It helped)

@rocketkittens
Copy link

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

@johnjbarton
Copy link
Contributor

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

oki2a24 added a commit to oki2a24/kanban-app that referenced this issue Jan 20, 2019
エラーメッセージを検索して、対処していった。

プラグイン不足

- javascript - Vue-test-utils can't find `Set()`: ReferenceError: Can't find variable: Set - Stack Overflow https://stackoverflow.com/questions/53764988/vue-test-utils-cant-find-set-referenceerror-cant-find-variable-set
- javascript - karma plugin dependencies not being found - Stack Overflow https://stackoverflow.com/questions/32425580/karma-plugin-dependencies-not-being-found
- Error: No provider for "framework:mocha"! (Resolving: framework:mocha) · Issue #42 · karma-runner/karma-mocha karma-runner/karma-mocha#42 (comment)
- Reporter plugins not working with karma 1.1.1? · Issue #2246 · karma-runner/karma karma-runner/karma#2246 (comment)
- "Can not load "coverage", it is not registered!" error when running · Issue #59 · karma-runner/karma-coverage karma-runner/karma-coverage#59 (comment)

Chrome Headless を使用するために Chromium インストールとパスを設定
apt-get update
apt-get install chromium
hromium --version
export CHROME_BIN=/usr/bin/chromium

- [launcher]: No binary for Chrome browser on your platform. · Issue #62 · karma-runner/karma-chrome-launcher karma-runner/karma-chrome-launcher#62
- Dockerを使ってHeadless Chromeを動かしてみる - Qiita https://qiita.com/dd511805/items/dfe03c5486bf1421875a
- Puppeteer をDockerコンテナで利用する - Qiita https://qiita.com/HeRo/items/9be64b559692e12cc109

Chrome Headless の起動オプション設定

- ChromeHeadless can't run as root with --no-sandbox anymore · Issue #158 · karma-runner/karma-chrome-launcher karma-runner/karma-chrome-launcher#158 (comment)
@JimLynchCodes
Copy link

I added 'karma-coverage', but still no files being found... 😥

Coverage reports should cover ALL files by default, and it should be EASY to configure this.

Currently, this is a seriously horrible dev experience, just sayin'.

@VicTMPDeV
Copy link

I had the same problem and just fix it after added 'karma-coverage' package, and then, in the karma.conf.js file, remove the require of karma-coverage-istanbul-reporter, and finally add the require of the new package, like this: require('karma-coverage')

I hope this will be helpfull.

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

Successfully merging a pull request may close this issue.