我通常使用浏览器= [‘PhantomJS’]运行我的规格与因果,因为它比chrome更快,我发现有点烦人,当chrome打开浏览器在每个启动窗口前面.
但是当我有一个错误,我需要调试,我将karma.conf.js浏览器更改为[‘Chrome’].
当我开始业务时,我想设置这个属性,像:’karma start –browsers = [Chrome]’.
这是可以吗?
您只需要使用–browsers参数,它将覆盖您的配置文件浏览器部分.
$karma start config/testacular.conf.js --browsers Chrome
例如,我只配置了一个小的Qt浏览器.如果我使用上面的行,它会运行Chrome.
INFO [karma]: Karma server started at http://localhost:9876/ INFO [launcher]: Starting browser Chrome INFO [Chrome 24.0 (Linux)]: Connected on socket id DxbVJNX0jIoe1CbaWf9V Chrome 24.0 (Linux): Executed 74 of 74 SUCCESS (0.443 secs / 0.232 secs) ...
或者,例如,我有firefox beta,极光,并在我的家释放.我运行测试版:
$karma start config/testacular.conf.js --browsers ~/firefox/firefox
$karma start --help Karma - Spectacular Test Runner for JavaScript. START - Start the server / do a single run. Usage: karma start [<configFile>] [<options>] Options: --port <integer> Port where the web server is running. --runner-port <integer> Port where the server is listening for runner. --auto-watch Auto watch source files and run on change. --no-auto-watch Do not watch source files. --log-level <disable | error | warn | info | debug> Level of logging. --colors Use colors when reporting and printing logs. --no-colors Do not use colors when reporting or printing logs. --reporters List of reporters (available: dots,progress,junit). --browsers List of browsers to start (eg. --browsers Chrome,ChromeCanary,Firefox). --capture-timeout <integer> Kill browser if does not capture in given time [ms]. --single-run Run the test when browsers captured and exit. --no-single-run Disable single-run. --report-slower-than <integer> Report tests that are slower than given time [ms]. --help Print usage and options. --version Print current version.