karma-runner / gulp-karma

Example of using Karma with Gulp.
310 stars 41 forks source link

Gulp exists with code 0 even if tests fail #6

Closed pkozlowski-opensource closed 10 years ago

pkozlowski-opensource commented 10 years ago

With the current setup Gulp doesn't exit with non-zero error code when tests are failing in the test task - if Karma run is the only operation we should exit Gulp process with the Karma's exit code.

pkozlowski-opensource commented 10 years ago

It turned out to be a bug in the gulp, was fixed in 3.8.4 via https://github.com/gulpjs/gulp/commit/d8d7542f58046f15d88795e3c48f952f54a02c3c.

JaKXz commented 9 years ago

I'm running gulp 3.8.10+ and my CI server is getting an exit code of 0 from my gulp test task... Not really sure where to start?

sabrinaluo commented 8 years ago

I have the same issue

sabrinaluo commented 8 years ago

Hi, I think the problem is how you config karma in gulp. Please notice that, done is a function which takes 1 argument // function (err) {finish(err, 'callback');}

:white_check_mark: :smile:

gulp.task('test', function (done) {
  new Server({
    configFile: __dirname + '/../karma.conf.js',
    singleRun: true
  }, done).start();
});

:white_check_mark: :smile:

gulp.task('test', function (done) {
  new Server({
    configFile: __dirname + '/../karma.conf.js',
    singleRun: true
  }, function(err){
    done(err);
  }).start();
});

:x: :x: :x: :cry:

gulp.task('test', function (done) {
  new Server({
    configFile: __dirname + '/../karma.conf.js',
    singleRun: true
  }, function(){
    done();
  }).start();
});