karma-runner / karma-chrome-launcher

A Karma plugin. Launcher for Chrome and Chrome Canary.
MIT License
467 stars 120 forks source link

ERROR [launcher]: Cannot load browser "ChromeHeadless": it is not registered! #165

Open mulmulovich opened 6 years ago

mulmulovich commented 6 years ago

Expected behaviour

after update of typescript, webpack, removing phantomJs and adding puppeteer tests will pass

Actual behaviour

when running tests, karma-launcher cannot load ChromeHeadless. and log this error:

16 01 2018 13:49:07.627:INFO [compiler.karma-typescript]: Compiling project using Typescript 2.6.2
16 01 2018 13:49:17.757:INFO [compiler.karma-typescript]: Compiled 132 files in 9499 ms.
16 01 2018 13:49:26.779:INFO [bundler.karma-typescript]: Bundled imports for 131 file(s) in 8510 ms.
16 01 2018 13:49:29.302:WARN [karma]: No captured browser, open http://localhost:9876/
16 01 2018 13:49:29.317:INFO [karma]: Front-end scripts not present. Compiling...
16 01 2018 13:49:36.550:INFO [karma]: Karma v2.0.0 server started at http://0.0.0.0:9876/
16 01 2018 13:49:36.550:INFO [launcher]: Launching browser ChromeHeadless with unlimited concurrency
16 01 2018 13:49:36.550:ERROR [launcher]: Cannot load browser "ChromeHeadless": it is not registered! Perhaps you are missing some plugin?
16 01 2018 13:49:36.550:ERROR [karma]: Found 1 load error
[13:49:36] Automated tests ended with FAILURE!!! error: process exited with code 1

tried to have plugins inside plugin section or remove plugins section altogether with no success.

icfantv commented 6 years ago

@mulmulovich are you trying to run this locally in your dev environment or on a remote CI environment? I'm able to run locally with no problem. You really only need the CHROME_BIN environment variable if you're running on a remote CI system (unless you have Chrome installed in some weird place on your local system).

m-spyratos commented 6 years ago

Update to latest version. It worked for me on version 2.2.

mulmulovich commented 6 years ago

thanks m-spyratos, latest version of what?

m-spyratos commented 6 years ago

Latest version of karma-chrome-launcher. I was having the same issue on v2.0.0. Upgrading to v2.2.0 fixed it. I would also suggest to upgrade karma as well to latest version.

mulmulovich commented 6 years ago

hi, i installed the latest karma-chrome-launcher since i posted the issue.. currently the tests fails imidiatly with this error:

HeadlessChrome 0.0.0 (Windows 7 0.0.0) ERROR
  {
    "message": "Uncaught TypeError: inherits is not a function\nat C:/Users/mulib/AppData/Local/Temp/karma-typescript-bundle-13864XK6RZttxc4ab.js:144717:1\n\nTypeError: inherits is not a function\n    at Object.global.wrappers.C:/mulib_workspaces/Optima/ui/FE/Core/node_modules/parse5/lib/extensions/position_tracking/preprocessor_mixin.js.../../utils/mixin (C:/Users/mulib/AppData/Local/Temp/karma-typescript-bundle-13864XK6RZttxc4ab.js:144717:1)\n    at require (C:/mulib_workspaces/Optima/ui/FE/Core/node_modules/karma-typescript/src/client/commonjs.js:17:25)\n    at C:/mulib_workspaces/Optima/ui/FE/Core/node_modules/karma-typescript/src/client/commonjs.js:18:24\n    at Object.global.wrappers.C:/mulib_workspaces/Optima/ui/FE/Core/node_modules/parse5/lib/extensions/location_info/tokenizer_mixin.js.util (C:/Users/mulib/AppData/Local/Temp/karma-typescript-bundle-13864XK6RZttxc4ab.js:148885:41)\n    at require (C:/mulib_workspaces/Optima/ui/FE/Core/node_modules/karma-typescript/src/client/commonjs.js:17:25)\n    at C:/mulib_workspaces/Optima/ui/FE/Core/node_modules/karma-typescript/src/client/commonjs.js:18:24\n
 at Object.global.wrappers.C:/mulib_workspaces/Optima/ui/FE/Core/node_modules/parse5/lib/extensions/location_info/parser_mixin.js../tokenizer_mixin (C:/Users/mulib/AppData/Local/Temp/karma-typescript-bundle-13864XK6RZttxc4ab.js:145849:34)\n    at require (C:/mulib_workspaces/Optima/ui/FE/Core/node_modules/karma-typescript/src/client/commonjs.js:17:25)\n    at C:/mulib_workspaces/Optima/ui/FE/Core/node_modules/karma-typescript/src/client/commonjs.js:18:24\n    at Object.global.wrappers.C:/mulib_workspaces/Optima/ui/FE/Core/node_modules/parse5/lib/parser/index.js.../tree_adapters/default (C:/Users/mulib/AppData/Local/Temp/karma-typescript-bundle-13864XK6RZttxc4ab.js:146065:31)",
    "str": "Uncaught TypeError: inherits is not a function\nat C:/Users/mulib/AppData/Local/Temp/karma-typescript-bundle-13864XK6RZttxc4ab.js:144717:1\n\nTypeError: inherits is not a function\n    at Object.global.wrappers.C:/mulib_workspaces/Optima/ui/FE/Core/node_modules/parse5/lib/extensions/position_tracking/preprocessor_mixin.js.../../utils/mixin (C:/Users/mulib/AppData/Local/Temp/karma-typescript-bundle-13864XK6RZttxc4ab.js:144717:1)\n    at require (C:/mulib_workspaces/Optima/ui/FE/Core/node_modules/karma-typescript/src/client/commonjs.js:17:25)\n    at C:/mulib_workspaces/Optima/ui/FE/Core/node_modules/karma-typescript/src/client/commonjs.js:18:24\n    at Object.global.wrappers.C:/mulib_workspaces/Optima/ui/FE/Core/node_modules/parse5/lib/extensions/location_info/tokenizer_mixin.js.util (C:/Users/mulib/AppData/Local/Temp/karma-typescript-bundle-13864XK6RZttxc4ab.js:148885:41)\n    at require (C:/mulib_workspaces/Optima/ui/FE/Core/node_modules/karma-typescript/src/client/commonjs.js:17:25)\n    at C:/mulib_workspaces/Optima/ui/FE/Core/node_modules/karma-typescript/src/client/commonjs.js:18:24\n    at
Object.global.wrappers.C:/mulib_workspaces/Optima/ui/FE/Core/node_modules/parse5/lib/extensions/location_info/parser_mixin.js../tokenizer_mixin (C:/Users/mulib/AppData/Local/Temp/karma-typescript-bundle-13864XK6RZttxc4ab.js:145849:34)\n    at require (C:/mulib_workspaces/Optima/ui/FE/Core/node_modules/karma-typescript/src/client/commonjs.js:17:25)\n    at C:/mulib_workspaces/Optima/ui/FE/Core/node_modules/karma-typescript/src/client/commonjs.js:18:24\n    at Object.global.wrappers.C:/mulib_workspaces/Optima/ui/FE/Core/node_modules/parse5/lib/parser/index.js.../tree_adapters/default (C:/Users/mulib/AppData/Local/Temp/karma-typescript-bundle-13864XK6RZttxc4ab.js:146065:31)"
  }

it's probably not related to the launcher anymore but to karma-typescript... any idea why its happens?

floer32 commented 6 years ago

~Tip for others... I missed something obvious first time I saw this thread. If you previously had no plugins entry you'll need to add a plugins entry with 'karma-chrome-launcher' in the list. (I'm maintaining an existing project, & I'm new to Karma, so I missed this.) But, now you're overriding plugins, and you might lose some plugins. I used trial and error to find out my complete list.~

If you have a plugins list you need to make sure to add 'karma-chrome-launcher', but I guess also Karma should be auto-adding some. Reference: http://karma-runner.github.io/2.0/config/plugins.html

Not sure what I'm doing wrong but figured I should clarify my bad comment!

swetapatil1 commented 5 years ago

I am getting same error with version 2.2.0 of 'karma-chrome-launcher'. Any solutions?

dougludlow commented 5 years ago

I ran into this, but my karma-chrome-launcher was way outdated, v0.2.2. After I updated to latest, (v2.2.0) it worked fine.

manoharreddyporeddy commented 5 years ago

I am getting same error with version 2.2.0 of 'karma-chrome-launcher'. Any solutions?

Same with me.

antonpegov commented 5 years ago

Any updates on that error?

celwell commented 5 years ago

I ran into this, but my karma-chrome-launcher was way outdated, v0.2.2. After I updated to latest, (v2.2.0) it worked fine.

Oh, wow, my eyes glazed over the 0.2.2 -> 2.2.0 distinction; thanks for pointing it out!

kaypeekillz commented 4 years ago

Any updates on that error?

Any update please? I am running into the same error while using circle ci with github to run continuous integration

red2678 commented 3 years ago

FWIW, I had the same problem but my issue was that the path I had for my Karma.config.js in my angular.json file was incorrect. Karma still ran when I ran ng test because (as per Angualr.io)

The karma.conf.js file is a partial Karma configuration file. The CLI constructs the full runtime configuration in memory, based on application structure specified in the angular.json file, supplemented by karma.conf.js.

The error I was getting about my customLoader being missing is technically correct since Karma was not loading my config. So if the Karma config file specified in the angular.json file is not found, the CLI continues and makes a "default" config for Karma to run. This default does not know about any customLoaders.

My two cents: there should be some error outputted to the console that the specified karma config could not be found, but alas, there is not. Check your paths people!

Hope this helps someone.