可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I'm using karma to run my js tests on multiple browsers.
the test works on Chrome & Firefox but I can't activate them on IE.
I'm getting the following error message:
Can not load "IE", it is not registered! Perhaps you are missing some
plugin?
On my config file
SET CHROME_BIN=c:\Program Files (x86)\Google\Chrome\Application\chrome.exe
SET FIREFOX_BIN=C:\Program Files (x86)\Mozilla Firefox\firefox.exe
SET IE_BIN=C:\Program Files\Internet Explorer\iexplore.exe
I also tried this
SET IE_BIN=C:\Program Files (86)\Internet Explorer\iexplore.exe
I already installed karma-ie-launcher.
Can you help me?
回答1:
In the configuration file for your project (e.g. karma.config.js), check if you have the plugins listed
plugins : [
'karma-junit-reporter',
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-opera-launcher',
'karma-ie-launcher',
'karma-jasmine'
],
回答2:
You have to install the IE launcher, from your project directory where you have installed karma, install ie launcher:
$ npm install karma-ie-launcher
That should create a karma-ie-launcher folder under node_modules(default karma installation folder).
Mind that 'plugins:[]' configuration simply instruct Karma what to load, you still have to install the browser launchers if you have not done so in initial Karma installation.
回答3:
After installing the karma ie launcher, replace the index.js from the following file
https://github.com/karma-runner/karma-ie-launcher/pull/9
Please let me know if it does not work.
回答4:
Amend Package.Json
I had a similar problem with Chrome. After setting the environment variables as you did, what eventually worked was ensuring the following following entries with the specified version numbers in the package.json's devDependencies:
"karma-jasmine": "~0.2.2",
"karma-chrome-launcher": "~0.1.2",
Then perform:
npm update
回答5:
Running karma locally worked for me.
./node_modules/karma/bin/karma start
回答6:
I'm currently using npm to manage packages and plugins, so I don't know if the steps I followed are the same for you. I see that your question is two years old, I'm currently working on Karma 0.13.15.
Basically to solve this problem I've performed
npm install karma-ie-launcher --save-dev -save
This command can be used to download the IE launcher plugin and update karma.config.js.
You can find a list of all launchers here: https://www.npmjs.com/package/karma-ie-launcher
回答7:
Try wrapping your paths in quotes, e.g.:
SET IE_BIN="C:\Program Files (86)\Internet Explorer\iexplore.exe"
Also, make sure you've installed and configured Karma IE launcher.