Karma test runs fine but exits with code 1
if 0 of 0
tests are run. Does anyone know how to return exit code 0
and normally exit in this case? Using gulp-karma
which fails the task when no specs are run.
There is a configuration option that allows for empty test suites. Just add
failOnEmptyTestSuite: false
to your karma.conf.js
and the process will exit with exit code 0.
BR Chris
In your gulpfile, replace the "throw err" on the error callback in the your gulp test task with "this.emit('end')".
gulp.task('test', function() {
return gulp.src(testFiles)
.pipe(karma({
configFile: 'karma.conf.js',
action: 'run'
}))
.on('error', function(err) {
throw err;
});
});
so your test task now looks like;
gulp.task('test', function() {
return gulp.src(testFiles)
.pipe(karma({
configFile: 'karma.conf.js',
action: 'run'
}))
.on('error', function(err) {
this.emit('end');
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With