首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >吞咽测试后的Karma关闭浏览器

吞咽测试后的Karma关闭浏览器
EN

Stack Overflow用户
提问于 2015-06-24 10:12:42
回答 1查看 4.6K关注 0票数 4

我正在运行基本的茉莉花测试使用Chrome和Firefox在业力,从吞咽。但后来我的浏览器总是被关闭。无论测试是否成功,即使在任务和配置中将单个运行指定为false之后也是如此。

吞咽任务:

代码语言:javascript
复制
 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:

代码语言:javascript
复制
// 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结束的进程。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-07-01 09:07:59

当你使用吞咽业力时,你传递的论点与你直接传递给业力的论点是不同的。忽略上述singleRun参数。我将任务更改为以下内容(相反,指定了一个操作),并且正如您所期望的那样工作:

代码语言:javascript
复制
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
    });
});
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31023829

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档