我通过NodeJS v0.10.11
通过karma
和grunt
测试得到了最奇怪的错误。
最初,由于PhantomJS
没有启动,测试不会运行。更新NodeJS
后,我明白了:
[2013-06-19 03:16:12.743] [DEBUG] config - autoWatch set to false, because of singleRun
INFO [karma]: Karma server started at http://localhost:8080/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9 (Linux)]: Connected on socket id KVDuQs5niBzzc8KQSnFm
PhantomJS 1.9 (Linux): Executed 1 of 1 SUCCESS (0.327 secs / 0.041 secs)
ERROR [launcher]: Cannot start PhantomJS
为什么测试成功运行后会出错?
更新:添加代码
Gruntfile业力任务:
karma: {
unit: {
configFile: 'karma.conf.js',
singleRun: true
},
e2e: {
configFile: 'karma-e2e.conf.js',
singleRun: true
}
}
karma.conf.js
// Karma configuration
// base path, that will be used to resolve files and exclude
basePath = '';
// list of files / patterns to load in the browser
// removed the following because of warning 'test/mock/**/*.js',
files = [
JASMINE,
JASMINE_ADAPTER,
'app/components/angular/angular.js',
'app/components/angular-mocks/angular-mocks.js',
'app/scripts/*.js',
'app/scripts/**/*.js',
'test/spec/**/*.js'
];
// list of files to exclude
exclude = [];
// test results reporter to use
// possible values: dots || progress || growl
reporters = ['progress'];
// web server port
port = 8080;
// cli runner port
runnerPort = 9100;
// enable / disable colors in the output (reporters and logs)
colors = true;
// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel = LOG_INFO;
// enable / disable watching file and executing tests whenever any file changes
autoWatch = false;
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers = ['PhantomJS'];
// If browser does not capture in given timeout [ms], kill it
captureTimeout = 5000;
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun = false;