javascript 如何在运行 karma 时修复“没有服务器侦听端口 9876”错误?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20285701/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to fix "There is no server listening on port 9876" error while running karma?
提问by luboskrnac
I am running the following:
我正在运行以下内容:
PS D:\app> karma run
It shows the error:
它显示错误:
[2013-11-29 17:39:54.297] [DEBUG] config - Loading config D:\app\karma.conf.js
There is no server listening on port 9876
How do I fix this?
我该如何解决?
采纳答案by Maurice
They changed the delivery model for Karma recently
他们最近改变了 Karma 的交付模式
To install Karma itself, as you have already done:
要安装 Karma 本身,就像您已经完成的那样:
npm install karma -g
But then you need to install drivers for testing frameworks. For example for QUnit
但是随后您需要安装用于测试框架的驱动程序。例如对于 QUnit
npm install karma-qunit --save-dev
Next you have to install launchers for the different browsers. For example Chrome and IE
接下来,您必须为不同的浏览器安装启动器。例如 Chrome 和 IE
npm install karma-ie-launcher --save-dev
npm install karma-chrome-launcher --save-dev
And now you should be good to go.
现在你应该可以走了。
Now simply launch karma by using the start command with the config file as an input
现在只需使用 start 命令和配置文件作为输入来启动 karma
karma start path/to/tests/karma.conf.js
回答by luboskrnac
You should use karma start
command to execute karma test suite from command line.
您应该使用karma start
command 从命令行执行 karma 测试套件。