Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exits immediately on javascript syntax error #54

Closed
jaredbro opened this issue Jul 9, 2015 · 1 comment
Closed

Exits immediately on javascript syntax error #54

jaredbro opened this issue Jul 9, 2015 · 1 comment

Comments

@jaredbro
Copy link

jaredbro commented Jul 9, 2015

I'm working on a project that uses jasmine, selenium, and webdriverio to drive selenium based tests. I started using gulp-jasmine yesterday and have been running into a problem where the gulp execution just exits as soon as a syntax error is encountered in any of my jasmine test files.

This is a problem because my test process starts 2 node servers to support the tests and these (as well as the Selenium driver) are all left running when this exists. I'm running with the following gulp tasks:

gulp.task('selenium:jasmine', ['server:test', 'server:capture_api', 'selenium'], function (done) {
  return gulp.src('test/spec/**/*.js')
    .pipe(jasmine())
    .on('error', function(err) {
      console.log(err.toString());
      done();
    });
});

gulp.task('integration', ['selenium:jasmine'], function () {
  node_capture_api.kill();
  selenium.child.kill();
  browserSync.exit();
});

In this case, the on('error' is never run so the processes are never cleaned up.

@jbblanchet
Copy link
Contributor

Hi,

If I understand the problem correctly, this is not related to gulp-jasmine but to the limitation of error management in gulp (explanation). I've simplified your example and introduced gulp plumber in your stream, and it appears to work.

gulp.task('b', function (done) {
    gulp.src('*.spec.js')
        .pipe(plumber())
        .pipe(jasmine())
        .on('error', function(err) {
            console.log(err.toString());
        })
        .on('finish', done);
});

gulp.task('a', ['b'], function () {
    console.log("We're in b");
});

output is:

[11:47:30] Starting 'b'...
Error
SyntaxError in plugin 'gulp-jasmine'
Message:
    C:\POC\test-gulp-jasmine\test.spec.js:7
};
 ^
Unexpected token ;
[11:47:30] Finished 'b' after 43 ms
[11:47:30] Starting 'a'...
We're in b
[11:47:30] Finished 'a' after 103 µs

Closing for now, feel free to reopen if I misunderstood the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants