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

Reporter plugins not working with karma 1.1.1? #2246

Closed
msabramo opened this Issue Jul 10, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@msabramo
Copy link

msabramo commented Jul 10, 2016

Expected behavior

If I npm install karma-junit reporter karma-spec-report and put junit and/or spec in my reporters setting in karma.conf.js, or pass --reporters junit or pass --reporters spec, it should work.

Actual behavior

Somehow the reporter plugins don't seem to be getting registered. I get:

ERROR [reporter]: Can not load reporter "junit", it is not registered!
  Perhaps you are missing some plugin?

Here's the full output...

[marca@marca-mac2 docker-registry-frontend_2]$ ./node_modules/.bin/karma start --reporters junit test/karma.conf.js
10 07 2016 14:13:59.914:ERROR [reporter]: Can not load reporter "junit", it is not registered!
  Perhaps you are missing some plugin?
10 07 2016 14:13:59.963:WARN [karma]: No captured browser, open http://localhost:8080/
10 07 2016 14:13:59.974:WARN [karma]: Port 8080 in use
10 07 2016 14:13:59.974:INFO [karma]: Karma v1.1.1 server started at http://localhost:8081/
10 07 2016 14:13:59.974:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
10 07 2016 14:13:59.975:ERROR [karma]: Found 1 load error
[marca@marca-mac2 docker-registry-frontend_2]$ ./node_modules/.bin/karma start --reporters spec test/karma.conf.js
10 07 2016 14:14:02.899:ERROR [reporter]: Can not load reporter "spec", it is not registered!
  Perhaps you are missing some plugin?
10 07 2016 14:14:02.948:WARN [karma]: No captured browser, open http://localhost:8080/
10 07 2016 14:14:02.961:WARN [karma]: Port 8080 in use
10 07 2016 14:14:02.962:INFO [karma]: Karma v1.1.1 server started at http://localhost:8081/
10 07 2016 14:14:02.962:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
10 07 2016 14:14:02.963:ERROR [karma]: Found 1 load error

Enviroment Details

[marca@marca-mac2 docker-registry-frontend_2]$ npm list | grep karma
├─┬ karma@1.1.1
├── karma-jasmine@1.0.2
├─┬ karma-junit-reporter@1.1.0
├─┬ karma-phantomjs-launcher@1.0.1
├── karma-spec-reporter@0.0.26

- Karma version (output of `karma --version`):
[marca@marca-mac2 docker-registry-frontend_2]$ ./node_modules/.bin/karma --version
Karma version: 1.1.1
  • Relevant part of your karma.config.js file

Steps to reproduce the behaviour

  1. npm install karma-junit-reporter karma-spec-reporter
  2. Then:
[marca@marca-mac2 docker-registry-frontend_2]$ ./node_modules/.bin/karma start --reporters junit test/karma.conf.js
10 07 2016 14:41:21.777:ERROR [reporter]: Can not load reporter "junit", it is not registered!
  Perhaps you are missing some plugin
@msabramo

This comment has been minimized.

Copy link

msabramo commented Jul 10, 2016

With --log-level debug, I get:

[marca@marca-mac2 docker-registry-frontend_2]$ ./node_modules/.bin/karma start --reporters spec --log-level debug test/karma.conf.js
10 07 2016 15:00:30.884:DEBUG [config]: Loading config /Users/marca/dev/git-repos/docker-registry-frontend_2/test/karma.conf.js
10 07 2016 15:00:30.894:DEBUG [plugin]: Loading plugin karma-phantomjs-launcher.
10 07 2016 15:00:30.950:DEBUG [plugin]: Loading plugin karma-jasmine.
10 07 2016 15:00:30.959:DEBUG [web-server]: Instantiating middleware
10 07 2016 15:00:30.961:DEBUG [reporter]: Trying to load reporter: spec
10 07 2016 15:00:30.961:ERROR [reporter]: Can not load reporter "spec", it is not registered!
  Perhaps you are missing some plugin?
10 07 2016 15:00:30.961:DEBUG [karma]: Registered a load error of type reporter with name spec
...
@msabramo

This comment has been minimized.

Copy link

msabramo commented Jul 10, 2016

Sorry, this is user error. It turns out that I had a plugins definition that I hadn't noticed in the karma.conf.js file that was explicitly specifying the plugins and disabling any others.

    // Which plugins to enable
    plugins: [
      'karma-phantomjs-launcher',
      'karma-jasmine'
    ],

Once I take that out, things work fine.

@msabramo msabramo closed this Jul 10, 2016

@VenkateshRajavetrivel

This comment has been minimized.

Copy link

VenkateshRajavetrivel commented Jan 25, 2018

I guess, you don't need to remove,

plugins: [
  'karma-phantomjs-launcher',
  'karma-jasmine'
],

instead, you can add extra value,

plugins: [
  'karma-phantomjs-launcher',
  'karma-jasmine',
  'karma-spec-reporter'
],

oki2a24 added a commit to oki2a24/kanban-app that referenced this issue Jan 20, 2019

fix: 8.8.7 単体テストユーティリティの導入。Vue Test Utilsによる効率化。この状態で動かないのを修正する
エラーメッセージを検索して、対処していった。

プラグイン不足

- 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment