我正在运行基本的茉莉花测试使用Chrome和Firefox在业力,从吞咽。但后来我的浏览器总是被关闭。无论测试是否成功,即使在任务和配置中将单个运行指定为false之后也是如此。
吞咽任务:
karma = require('gulp-karma');
gulp.task('test', ['testsSetup'], function() {
// Be sure to return the stream
// NOTE: Using the fake './foobar' so as to run the files
// listed in karma.conf.js INSTEAD of what was passed to
// gulp.src !
return gulp.src('./foobar')
.pipe(karma({
configFile: 'karma.conf.js',
singleRun: false
}))
.on('error', function(err) {
// Make sure failed tests cause gulp to exit non-zero
console.log(err);
//this.emit('end'); //instead of erroring the stream, end it
});
});
karma.conf.js:
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome','Firefox'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false从成功测试中获得的吞咽输出的最后一部分:
Chrome 43.0.2357 (Windows70.0.0):成功3次(0.041秒/ 0.036秒)
Firefox38.0.0(Windows70.0.0):成功3次(0.001秒/ 0.013秒)
共计:6次成功
Chrome 43.0.2357 (Windows70.0.0):成功3次(0.041秒/ 0.036秒)
Firefox38.0.0(Windows70.0.0):成功3次(0.001秒/ 0.013秒)
共计:6次成功
11:09:27在4.52秒后完成了“测试”
以代码0结束的进程。
发布于 2015-07-01 09:07:59
当你使用吞咽业力时,你传递的论点与你直接传递给业力的论点是不同的。忽略上述singleRun参数。我将任务更改为以下内容(相反,指定了一个操作),并且正如您所期望的那样工作:
gulp.task('test', ['testsSetup'], function() {
// Be sure to return the stream
// NOTE: Using the fake './foobar' so as to run the files
// listed in karma.conf.js INSTEAD of what was passed to
// gulp.src !
return gulp.src('./foobar')
.pipe(karma({
configFile: 'karma.conf.js',
action: 'watch',
showStack: true
}))
.on('error', function(err) {
// Make sure failed tests cause gulp to exit non-zero
console.log(err);
this.emit('end'); //instead of erroring the stream, end it
});
});https://stackoverflow.com/questions/31023829
复制相似问题