Steve Gravrock
6a6fa7b29a
Tests for existing handling of non-Error global errors in Node
2024-03-22 09:15:22 -07:00
Steve Gravrock
4fcdbd39fb
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)
2022-08-21 16:17:18 -07:00
Steve Gravrock
f934e6d816
Assume that addEventListener/removeEventListener are present in browsers
...
Jasmine 3.0 dropped support for the last browser that didn't support
the standard event handler methods (IE 9).
2022-08-20 10:27:44 -07:00
Steve Gravrock
6c56ebc984
Added jasmine.spyOnGlobalErrorsAsync
...
* Allows testing code that's expected to prodeuce global errors or
unhandled promise rejections
* Fixes #1843
* Fixes #1453
2022-06-30 18:09:56 -07:00
Steve Gravrock
1166d10e43
Use const/let in specs, not var
2022-04-16 13:41:44 -07:00
Steve Gravrock
dd8a65cb60
Better reporting of unhandled promise rejections with truthy but non-Error reasons on Node
...
[#179227413 ]
2021-08-14 14:03:03 -07:00
Steve Gravrock
5f9315731e
Improved handling of unhandled promise rejections with no error in Node
...
* Fixes #1759
2021-04-06 18:48:56 -07:00
Steve Gravrock
8d0c52e2ec
Temporarily removed global error handler stack validation
...
This fails somewhat frequently (every 2-4 runs of Jasmine's own test
suite) on Safari. Until we get to the bottom of that, it's removed.
2021-03-14 11:46:23 -07:00
Gregory Huczynski
905e3fc3f9
Enable custom promise error handling through overriding of global.onerror
2020-11-24 11:04:04 -08:00
Steve Gravrock
0b81705c11
Detect global error handler stack corruption
2020-09-02 14:43:17 -07:00
Steve Gravrock
fd5b9ce1ae
Fixed spec failure in IE
2020-01-20 11:40:26 -08:00
Steve Gravrock
58c63e98bb
Include stack traces in unhandled promise rejection messages
2020-01-20 10:50:42 -08:00
johnjbarton
1545112744
feat(GlobalErrors): Route unhandledrejections to onerror
...
Fixes #1777
2020-01-14 09:38:59 -08:00
Ferdinand Prantl
527619b0aa
Restore the original global error hanler to pass all parameters along
2019-08-11 09:31:43 +02:00
Ferdinand Prantl
4858a62fdc
Add a unit test for the global error handling including stacktrace
2019-07-16 12:00:09 +02:00
Gregg Van Hove
b4cbe9850f
add prettier and eslint
2019-05-21 18:23:48 -07:00
Gregg Van Hove
4991f2a713
Merge branch 'print_global_error_type' of https://github.com/jbunton-atlassian/jasmine into jbunton-atlassian-print_global_error_type
...
- Merges #1632 from @jbunton-atlassian
2019-02-11 09:02:16 -08:00
James Bunton
d803bd12a6
When catching a global error in Node.js, print the type of error
2018-12-11 08:32:45 +11:00
johnjbarton
f1ebe05f1d
Report unhandled rejections as globalErrors.
...
Extend existing support for uncaughtExceptions to unhandledRejections now that many tests are async.
2018-03-01 16:47:50 -08:00
Steve Gravrock
10f1220e55
Don't mask errors that occur when no handlers are installed
...
It's possible for async code to cause an error when Jasmine
doesn't have any listeners registered internally. This causes
Jasmine to crash (Node) or log to the console (browser)
because of trying to call the nonexistent handler. This change
doesn't fix the overall problem but it does ensure that the
original error is logged rather than Jasmine's internal error.
2017-05-08 11:09:32 -07:00
Gregg Van Hove
1042c9a2dd
Collect unhandled exceptions and pass them to the current runnable
...
Fixes #529
Fixes #937
2017-03-07 16:32:11 -08:00