吞噬摩卡如何通过编译器标志? [英] gulp-mocha how to pass the compilers flag?

查看:102
本文介绍了吞噬摩卡如何通过编译器标志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 gulp-mocha模块,但无法找出一个好的方法来传递编译器标志。有没有办法将这个包含在我的大嘴巴任务中?也许在一个单独的管道中?



从命令行运行mocha的示例(正常工作)

mocha --compilers。:my_compiler.js test / ** / *。js



示例如果使用gulp-mocha(但我可以在哪里指定编译器)?

  gulp.task('test',function(){
gulp.src([test / ** ($ {
记者:'spec'
}))$ b $(
) b .pipe(exit());
});

我没有看到gulp-mocha插件下的编译器选项,所以我想我需要以某种方式通过管道附加文本添加编译器?

解决方案

我刚刚注意到底部状态的文档 -


对于CoffeeScript支持,请使用CoffeeScript 1.6添加require('coffee-script'),或者使用CoffeeScript 1.7 +来添加require('coffee-script / register')。 blockquote>

我在我的gulp文件 require('./ my_compiler'); 的顶部添加了一个require语句>这似乎工作。

I'm trying to use the gulp-mocha module but can't figure out a good way to pass over the compilers flag. Is there a way to include this in my gulp task? Maybe in a separate pipe somehow?

Example if running mocha from command line (works fine)
mocha --compilers .:my_compiler.js test/**/*.js

Example if using gulp-mocha (but where can I specify a compiler)?

gulp.task('test', function () {
    gulp.src(["test/**/*.js"], {
        read: false
    })
        .pipe(mocha({
            reporter: 'spec'
        }))
        .pipe(exit());
});

I don't see a compilers option under the gulp-mocha plugin, so I'm thinking I need to somehow add the compilers by appending the text through a pipe somehow?

解决方案

I just noticed the docs at the bottom state -

For CoffeeScript support, add require('coffee-script') with CoffeeScript 1.6- or require('coffee-script/register') with CoffeeScript 1.7+.

I added a require statement for my own compiler at the top of my gulp file require('./my_compiler'); and this seemed to work.

这篇关于吞噬摩卡如何通过编译器标志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆