NullRefExcep / gulp-casperjs

gulp plugin for CasperJS
MIT License
12 stars 11 forks source link

gulp-casperjs: How to fail the build? #9

Open skananitos opened 8 years ago

skananitos commented 8 years ago

Hi, I want my Gulp build to fail, if there are errors in CasperJS tests. Is there a possibility to use something like "fail reporter"?

ZAYEC77 commented 8 years ago

Hello, thanks for issue Can you give some usage example of your case? I mean part of gulpfile etc.

skananitos commented 8 years ago

Hi @ZAYEC77, thanks for your reply. So the following is a part of my Gulp file:

var casperJs   = require("gulp-casperjs");
...
// casperjs runs on phantomjs
gulp.task("test", function () {
    gulp.src("tests/maintest.js")
    .pipe(casperJs())
});
...
gulp.task("dev", [
    "watch",
    "serve",
    "test"
]);

The solution that I found is to include the gulp-exit dependency on my code. So, I updated it as:

var casperJs   = require("gulp-casperjs"),
      exit          = require("gulp-exit");
...
// casperjs runs on phantomjs
gulp.task("test", function () {
    gulp.src("tests/portaltest.js")
    .pipe(casperJs())
    .pipe(exit());
});

Do you have to propose me a better approach?

ZAYEC77 commented 8 years ago

@skananitos Do you use gulp-exit for termination of casperjs, do you have problem with this? Or you want better fail report?