Breaking change: use addEventListener rather than setting window.onerror
* Generally simplifies error handling in browsers * Makes Jasmine's own integration tests easier to debug * Stack traces will be provided for more global errors * ... but less error information will be provided in some browsers if the error comes from a file:// URL (use `npx serve` or similar instead) * Jasmine will no longer override existing onerror handlers in browsers * Setting window.onerror will no longer override Jasmine's global error handling (use jasmine.spyOnGlobalErrors instead)
This commit is contained in:
@@ -149,20 +149,14 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
|
||||
if (!options.suppressLoadErrors) {
|
||||
installGlobalErrors();
|
||||
globalErrors.pushListener(function loadtimeErrorHandler(
|
||||
message,
|
||||
filename,
|
||||
lineno,
|
||||
colNo,
|
||||
err
|
||||
) {
|
||||
globalErrors.pushListener(function loadtimeErrorHandler(error, event) {
|
||||
topSuite.result.failedExpectations.push({
|
||||
passed: false,
|
||||
globalErrorType: 'load',
|
||||
message: message,
|
||||
stack: err && err.stack,
|
||||
filename: filename,
|
||||
lineno: lineno
|
||||
message: error ? error.message : event.message,
|
||||
stack: error && error.stack,
|
||||
filename: event && event.filename,
|
||||
lineno: event && event.lineno
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user