karma-jasmine icon indicating copy to clipboard operation
karma-jasmine copied to clipboard

Support reporting unhandledrejection errors.

Open johnjbarton opened this issue 7 years ago • 2 comments

New feature, so far only chrome perhaps: https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onunhandledrejection

I would send a PR for this if encouraged.

johnjbarton avatar Jun 28 '17 20:06 johnjbarton

@johnjbarton why would you think it should be implemented in the karma-jasmine adapter?

Thanks

maksimr avatar Aug 22 '17 22:08 maksimr

The unhandled rejections are a kind of global test error message. (Of course like, all error messages, some may be harmless to the test objective). Generally test error messages are reported via karma reporters. Therefore my goal is to emit the unhandled rejection error messages in the reporter.

Based on the system architecture, karma-jasmine is the component that routes information to the reporter. The framework adapters like karma-jasmine call karma-runner's in-browser functions with data that karma-runner ferries to the server and emits via its reporter API.

So it seemed reasonable to me to us the karma-jasmine adapter to report the unhandled rejections.

I suppose this could be built into the karma-runner context as it is not jasmine specific.

johnjbarton avatar Aug 24 '17 17:08 johnjbarton