I upgraded from karma v2 to karma v4 and am having an issue where the karma server crashes if there is an error in the babel preprocessor. With version 2, the error would be logged in the console, but the server would continue to run. Is there a way to handle errors / unhandledRejections so that the server does not crash? Thanks!
ERROR [preprocessor.babel]:
ERROR [karma-server]: UnhandledRejection
DEBUG [launcher]: Disconnecting all browsers
DEBUG [launcher]: CAPTURED -> BEING_KILLED
DEBUG [launcher]: BEING_KILLED -> BEING_FORCE_KILLED
DEBUG [launcher]: Process Chrome exited with code 0 and signal null
DEBUG [temp-dir]: Cleaning temp dir DEBUG [launcher]: Finished all browsers
DEBUG [launcher]: BEING_FORCE_KILLED -> FINISHED
DEBUG [launcher]: FINISHED -> FINISHED
karma.config.js file (couldn't get formatting to work)In your config you can register a handler for infrastructure_error
process.on('infrastructure_error', (error) => {
console.error('infrastructure_error', error);
});
That will point you to the error. But exiting in this case is by design. Unhandled rejections are exceptions, continuing does not make sense.
Thanks @johnjbarton.
Most helpful comment
In your config you can register a handler for
infrastructure_errorThat will point you to the error. But exiting in this case is by design. Unhandled rejections are exceptions, continuing does not make sense.