gpt4 book ai didi

javascript - gulp-mocha 如何传​​递编译器标志?

转载 作者:可可西里 更新时间:2023-11-01 02:49:41 26 4
gpt4 key购买 nike

我正在尝试使用 gulp-mocha module但无法找到传递编译器标志的好方法。有没有办法将其包含在我的 gulp 任务中?也许以某种方式在一个单独的管道中?

从命令行运行 mocha 的示例(工作正常)
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
}
}));
});

关于javascript - gulp-mocha 如何传​​递编译器标志?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28858957/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com