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

When used with gulp causes gulp process not to close for around 2 minutes #4

Closed
keirlawson opened this issue Jan 19, 2016 · 8 comments

Comments

@keirlawson
Copy link

Using Node 4.2.4 with various versions of Karma 0.13.x with even the simplest test suites and karma configurations, using gulp to invoke karma means that after the task completes successfully I have to wait around 2 minutes or so for gulp to finally terminate. I do not experience this issue with other launchers.

@badeball
Copy link
Owner

Hi, @keirlawson

Thanks for the reporting this issue. Can you please provide a minimal working example for me to reproduce it?

@keirlawson
Copy link
Author

Minimal working example here: https://gist.github.com/keirlawson/ede918f818a49f21dc02

@hodavidhara
Copy link
Contributor

I'm seeing this issue as well. Works fine with the chrome launcher but hangs with jsdom.

@jeromeyackley
Copy link

I was able to solve this problem by changing the gulp task named "test" in this example in gulpfile.js; https://gist.github.com/keirlawson/ede918f818a49f21dc02 to this:

gulp.task('test', function (done) {
  new Server({
    configFile: __dirname + '/karma.conf.js',
    singleRun: true
  }, function(exitStatus) {
    let returnMessage = undefined;
    if(exitStatus === 1) {
        returnMessage = 'Unit tests failed.';
    }
    done(returnMessage);
    process.exit(exitStatus);
  ).start();
});

@badeball
Copy link
Owner

badeball commented Aug 4, 2016

I'm sorry for taking so long in coming back to you. I've been having quite a hard time debugging this issue. @jeromeyackley is right in that explicitly exiting the process will solve the issue and for the time being, it is the only solution.

What happens is it that some handler created by jsdom or the Karma application itself is lingering and preventing node from exiting. Gulp itself won't explicitly exit, it will simply clean up after itself and expect that to be enough.

This issue is also mentioned in EG. gulp-mocha. I'll make sure it gets into the readme.

@badeball badeball reopened this Jan 10, 2019
@badeball
Copy link
Owner

I've tried to solve this with 119ab34 and released it as 7.0.0-rc1. @keirlawson, or those whom still experience this issue, do you mind confirming the fix?

@keirlawson
Copy link
Author

Yep, looks like its fixed, time with 6.1.5:

npx gulp test 1.29s user 0.13s system 2% cpu 1:00.79 total

with 7.0.0-rc1:

npx gulp test 1.13s user 0.08s system 19% cpu 6.027 total

@badeball
Copy link
Owner

Great! I've published 7.0.0, which is identical to that which was rc1.

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

4 participants