Sup*_*Way 21 google-chrome jasmine karma-jasmine
我一直在尝试使用karma-chrome-launcher运行我的测试,但每次运行我的测试时都会抛出此错误:
INFO [启动器]:启动浏览器Chrome错误[启动器]:无法启动Chrome
INFO [launcher]: Trying to start Chrome again (1/2).
ERROR [launcher]: Cannot start Chrome
INFO [launcher]: Trying to start Chrome again (2/2).
ERROR [launcher]: Cannot start Chrome
ERROR [launcher]: Chrome failed 2 times (cannot start). Giving up.
Run Code Online (Sandbox Code Playgroud)
这是我的karma.conf.js代码:
// Karma configuration
// Generated on Mon Mar 23 2015 14:04:19 GMT-0300 (BRT)
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: 'www',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
'lib/ionic/js/angular/angular.js',
'lib/ionic/js/angular/angular-animate.js',
'lib/ionic/js/angular/angular-sanitize.js',
'../node_modules/jasmine-core/lib/jasmine-core/jasmine.js',
'../node_modules/mock-local-storage/lib/mock-localstorage.js',
'../node_modules/angular-mocks/angular-mocks.js',
//'../node_modules/requirejs/require.js',
'lib/ionic/js/angular/angular-resource.js',
'lib/ionic/js/angular-ui/angular-ui-router.js',
'lib/ionic/js/ionic.js',
'lib/ionic/js/ionic-angular.js',
/*'../tests/libs/ngCordovaMocks.min.js',*/
'js/lib/ng-cordova.min.js',
'js/*.js',
'js/controllers/*.js',
'js/services/*.js',
'js/factory/*.js',
//'../tests/*.js',
'../tests/**/*.js'
],
// list of files to exclude
exclude: [
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'html'],
htmlReporter: {
outputFile: '../tests/report/index.html'
},
// web server port
port: 9876,
plugins : [
'karma-junit-reporter',
'karma-jasmine',
'karma-phantomjs-launcher',
'karma-chrome-launcher'
//'karma-htmlfile-reporter'
],
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['PhantomJS'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false
});
};
Run Code Online (Sandbox Code Playgroud)
我在这里安装模块:https://www.npmjs.com/package/karma-chrome-launcher
谢谢!
Ger*_*ros 12
我遇到了同样的问题并尝试了很多我发现的建议解决方案,但最终解决它的是删除node_modules文件夹并通过npm install获取所有新内容
我的构建环境也有同样的问题。
我所做的是按照 Rafael Cichocki 的建议启用调试:
logLevel: config.LOG_DEBUG
Run Code Online (Sandbox Code Playgroud)
然后尝试使用与调试输出中可见的完全相同的行启动 chrome 浏览器。
原来 chrome 浏览器由于缺少 ttf 字体而崩溃。所以运行:
apt-get install ttf-freefont
Run Code Online (Sandbox Code Playgroud)
为我解决了这个问题,karma 开始推出 chrome。
在 中Karma.conf.js,将超时增加到 60000
captureTimeout: 60000,
browserDisconnectTimeout: 60000,
browserDisconnectTolerance: 3,
browserNoActivityTimeout: 60000,
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16915 次 |
| 最近记录: |