karma-runner / gulp-karma

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

Is there a way to reuse the server? #25

Closed ghost closed 9 years ago

ghost commented 9 years ago

I tried

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

but it does not work, it does not complete the gulp task.

pkozlowski-opensource commented 9 years ago

@inf3rno It is not clear for me what you are asking for here. In any case what you are trying to do is not correct since you are not properly handling error path (when karma run fails).

ghost commented 9 years ago

@pkozlowski-opensource Handling error path depends on the circumstances. If I want the task not to fail by test failure, then the current code is okay... I wanted to reuse the server instance and the browser window in the next task run, but it would require creating a daemon, because gulp exits from the process after a timeout period. I found a workaround, I use a different config, run karma from console instead of gulp and turned on autoWatch. This was it is fast enough to develop applications.