当任务失败时,Gulp返回0 [英] Gulp returns 0 when tasks fail

查看:169
本文介绍了当任务失败时,Gulp返回0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的小项目中使用Gulp来运行测试并为我的代码添加皮棉。当任何这些任务失败时,Gulp总是退出,返回代码为0.如果我手动运行jshint,它将以非零代码退出,因为它应该是。

这是我很简单gulpfile



我是否需要以某种方式明确告诉Gulp返回一个有意义的值?这是Gulp的错,还是可能是gulp-jshint和gulp-jasmine插件被指责? 解决方案

此提交中。



它的工作原理像这样:

$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $。$ ())
.pipe(jshint.reporter(default))
.pipe(jshint.reporter(fail));

我一直在circleci上使用它,它可以工作!


I'm using Gulp in my small project in order to run tests and lint my code. When any of those tasks fail, Gulp always exits with return code 0. If I run jshint by hand, it exits with non-zero code as it should.

Here's my very simple gulpfile.

Do I need to somehow explicitly tell Gulp to return a meaningful value? Is this Gulp's fault, or maybe the gulp-jshint and gulp-jasmine plugins are to blame?

解决方案

A fix has been introduced in this commit.

It works something like this:

gulp.src("src/**/*.js")
  .pipe(jshint())
  .pipe(jshint.reporter("default"))
  .pipe(jshint.reporter("fail"));

I have been using it on circleci and it works a treat!

这篇关于当任务失败时,Gulp返回0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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