我正在尝试用以前存在的配置来运行mocha。moch.opts包含以下行。
--timeout 999999
--ui tdd
--full-trace
--recursive
--compilers js:babel-register如何在此处添加它们:
gulp.task('test', function() {
return gulp.src('sampleTest/*.js', { read: false })
.pipe(mocha());
});发布于 2017-09-25 23:34:26
我相信您可以在传递给gulp-mocha的options对象上创建属性,也可以让它读取options文件。在我的例子中,我不想复制像--recursive或--require test/_init.js这样的东西,但我确实想覆盖报告器,所以我使用如下所示的代码:
gulp.task('test', ['compile'], function() {
return gulp.src([], { read: false })
.pipe(mocha({
opts: 'test/mocha.opts',
reporter: 'min'
}))
.on('error', gutil.log);
});你可能想修改它,这样它就不会假设测试文件的默认路径(例如test/*.js),但在我的简单例子中,我甚至不需要传递路径到mocha。我只是使用gulp来触发它(就好像我是在命令行上运行的,类似于mocha --opts test/mocha.opts --reporter min)
发布于 2018-07-26 18:01:29
选项直接通过传递给二进制文件,因此您可以在camelCased表单中使用它的任何命令行选项。this is the document link
gulp.task('test', ['compile'], function() {
return gulp.src([], { read: false })
.pipe(mocha({
timeout: 999999,
fullTrace: true,
reporter: 'min'
}))
.on('error', gutil.log);
});发布于 2017-09-30 15:41:18
将setTimeout调用添加到mocha调用之后
.pipe(mocha(),setTimeout(function() {
}, 999999))https://stackoverflow.com/questions/44710531
复制相似问题