Karma 0.13.19 taking long time to complete when run via gulp
See original GitHub issueI am opening a new ticket as this seems to be fallout from #1782 and the socket.io upgrade to 1.4.0.
I’ve just noticed a side effect from upgrading to 0.13.19; gulp karma test tasks take much longer to exit after the test run.
gulp.task('test:ng', function(done) {
new Server({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done).start();
});
Previously the above task used to complete immediately after tests have completed. on 0.13.9, there is a pause of ~30 seconds after the karma runner completes the tests and the task exits.
gulp.task('test:ng', function(done) {
new Server({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, function() {
console.log('done');
done();
}).start();
});
The above outputs done to the console but the gulp task still doesn’t complete until after ~30 seconds.
cc @nazar
Issue Analytics
- State:
- Created 8 years ago
- Reactions:8
- Comments:37 (5 by maintainers)
Top Results From Across the Web
Gulp exit in error with Karma tests failing - Stack Overflow
Fairly new to testing AngularJS applications, I am using a mixture of Gulp (4.0), AngularJS (1.4.5), Karma (0.13.15) and Jasmine (2.3.4) for ...
Read more >Using Gulp to Build and Deploy .NET Apps on Windows
I've been using Grunt to build and deploy .NET apps for about a year now. Its a huge improvement over Rake and the...
Read more >Changelog - Karma test runner
Using Karma to run Dart code in the browser is no longer supported. Use your favorite Dart-to-JS compiler instead. dart file type has...
Read more >ES6 + browserify + babel + gulp + jasmine | Carlos Blé
As an example, I installed karma via npm the latest version. But when running gulp from the command line it stopped working with...
Read more >Karma - npm.io
A simple tool that allows you to execute JavaScript code in multiple real browsers. The main purpose of Karma is to make your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am also seeing this on version 1.1.1.
@nazar Seeing the same thing here.
After doing some digging:
The 30 second timeout is from https://github.com/websockets/ws/blob/master/lib/WebSocket.js#L129, where if the WebSocket is closed uncleanly (without close acknowledgement from the client), the socket goes into limbo mode, waiting to receive this ack before fully closing out.
It seems like Karma, in
singleRun
mode, will try to kill the browser immediately uponbrowser_complete
, rather than first closing the socket and waiting for completion of socket close. Ultimately, Karma will try to push some buffered information down the socket (trying to inform the browser of its own startup, actually), which hits EPIPE, and triggers this delayed close mode of the socket, keeping the Karma process alive an additional 30 seconds.Regarding PhantomJS versions, I was able to reproduce this both with PhantomJS 2.x and with PhantomJS 1.9.8 + karma-phantomjs-launcher 0.2.3. Current workaround is to revert to karma 0.13.9, karma-phantomjs-launcher 0.2.1 which we were previously using.