@@ -7,8 +7,8 @@ promise rejection event if you allow control to return to the JavaScript
77runtime without first attaching a rejection handler. That's true even if you
88don't do anything with the promise. Jasmine turns unhandled rejections into
99failures because they almost always mean that something unexpectedly went wrong,
10- and becuase there's no way to distinguish "real" unhandled rejections from the
11- ones that would eventually be handled in the future.
10+ and because there's no cheap way to distinguish "real" unhandled rejections from
11+ the ones that will eventually be handled in the future.
1212
1313Consider this spec:
1414
@@ -24,7 +24,6 @@ it('causes an unhandled rejection', async function() {
2424});
2525```
2626
27-
2827The rejection will eventually be handled via the ` try ` /` catch ` . But the JS
2928runtime detects the unhandled rejection before that part of the spec runs. This
3029happens because the ` await somethingAsync() ` call returns control to the JS
@@ -47,7 +46,7 @@ it('causes an unhandled rejection', async function() {
4746});
4847```
4948
50- As a last resort , you can suppress the unhandled rejection by attaching a no-op
49+ Alternately , you can suppress the unhandled rejection by attaching a no-op
5150catch handler:
5251
5352```
@@ -65,5 +64,12 @@ it('causes an unhandled rejection', async function() {
6564});
6665```
6766
67+ Another option is to set the [ detectLateRejectionHandling] ( /api/edge/Configuration.html#detectLateRejectionHandling )
68+ core configuration property to true. With that option enabled, Jasmine will use
69+ the browser or Node's ` rejectionhandled ` event to detect rejections that were
70+ handled after the browser or Node emitted an unhandled rejection. The
71+ ` detectLateRejectionHandling ` option is off by default because it imposes a
72+ performance penatly.
73+
6874See also [ How can I configure a spy to return a rejected promise without triggering an unhandled promise rejection error?] ( #return-reject )
6975for how to avoid unhandled rejections when configuring spies.
0 commit comments