Karma doesn't exit properly when using public api with the finish callback
See original GitHub issueUsing Karma’s server public API with a done callback makes the whole node process “stuck” - there are probably some event listeners that prevent node process from exiting properly. A simple reproduce scenario:
var karma = require('karma').server;
karma.start({
//transports: ['websocket', 'xhr-polling', 'jsonp-polling'],
browsers: ['Chrome'],
frameworks: ['jasmine'],
files: [
'src/**/*.js',
'test/**/*.spec.js'
],
singleRun: true
}, function(karmaExitCode) {
console.log('Karma exited with ', karmaExitCode);
console.log('but the process will never exit...');
});
Interestingly, removing the flash from the list of transports make the Karma exit after a while (~20s after test are finished on my machine).
There is a small repo with the reproduce scenario here: https://github.com/karma-runner/gulp-karma/blob/exit_pb/exitTest.js I will be digging into the topic but any help from someone more knowledgeable about Karma internals would be highly appreciated.
Issue Analytics
- State:
- Created 9 years ago
- Comments:16 (7 by maintainers)
Top Results From Across the Web
Karma can't capture PhantomJS - Stack Overflow
Karma is not able to run test cases on phantomJS · Karma doesn't exit properly when using public api with the finish callback...
Read more >Public Api - Karma test runner
Most of the time, you will be using Karma directly from the command line. You can, however, call Karma programmatically from your node...
Read more >Node.js – Karma can't capture PhantomJS – iTecNote
Best Solution · Karma is not able to run test cases on phantomJS · Karma doesn't exit properly when using public api with...
Read more >Frontend testing standards and style guidelines - GitLab Docs
Frontend testing standards and style guidelines. There are two types of test suites encountered while developing frontend code at GitLab. We use Jest...
Read more >Testing Workflow for Web Components - DEV Community
We're using karma and chai's BDD syntax, so we group sets of tests ( it ) under the features or APIs they relate...
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
process.exit()
is fatal, so that won’t work.As a workaround, I am forcing the karma server to be executed in a separate process via ‘gulp-multi-process’
In addition my karma config has autoWatch off, and singleRun on. Hence, I am using gulp to watch my files and delegating all the test tasks (including report generation) to karma.