吞噬摩卡如何通过编译器标志?

编程入门 行业动态 更新时间:2024-10-27 10:25:42
本文介绍了吞噬摩卡如何通过编译器标志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试使用 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.

更多推荐

吞噬摩卡如何通过编译器标志?

本文发布于:2023-07-16 10:56:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1120963.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:编译器   摩卡   标志

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!