Closed keirlawson closed 5 years ago
Hi, @keirlawson
Thanks for the reporting this issue. Can you please provide a minimal working example for me to reproduce it?
Minimal working example here: https://gist.github.com/keirlawson/ede918f818a49f21dc02
I'm seeing this issue as well. Works fine with the chrome launcher but hangs with jsdom.
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();
});
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.
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?
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
Great! I've published 7.0.0, which is identical to that which was rc1.
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.