我正在尝试使用 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.
更多推荐
吞噬摩卡如何通过编译器标志?
发布评论