我正在尝试使用gulp-mocha 模块 https://github.com/sindresorhus/gulp-mocha但无法找出传递编译器标志的好方法。有没有办法将其包含在我的 gulp 任务中?也许在一个单独的管道中?
从命令行运行摩卡的示例(工作正常)
mocha --compilers .:my_compiler.js test/**/*.js
使用 gulp-mocha 的示例(但我在哪里可以指定编译器)?
gulp.task('test', function () {
gulp.src(["test/**/*.js"], {
read: false
})
.pipe(mocha({
reporter: 'spec'
}))
.pipe(exit());
});
我在 gulp-mocha 插件下没有看到编译器选项,所以我想我需要通过某种方式通过管道附加文本来添加编译器?
var mocha = require('gulp-mocha');
var babel = require('babel/register');
gulp.task('mocha', function() {
return gulp.src(['test/**/*.js'])
.pipe(mocha({
compilers: {
js: babel
}
}));
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)