@@ -174,6 +174,15 @@ describe('skips sending errors to Bugsnag', () => {
174174 expect ( onNotify ) . not . toHaveBeenCalled ( )
175175 expect ( mockOutput . debug ( ) ) . toMatch ( 'Skipping Bugsnag report' )
176176 } )
177+
178+ test ( 'when error is expected' , async ( ) => {
179+ const mockOutput = mockAndCaptureOutput ( )
180+ const res = await sendErrorToBugsnag ( new error . AbortError ( 'In test' ) , 'expected_error' )
181+ expect ( res . reported ) . toEqual ( false )
182+ expect ( res . unhandled ) . toBeUndefined ( )
183+ expect ( onNotify ) . not . toHaveBeenCalled ( )
184+ expect ( mockOutput . debug ( ) ) . toMatch ( 'Skipping Bugsnag report for expected error' )
185+ } )
177186} )
178187
179188describe ( 'sends errors to Bugsnag' , ( ) => {
@@ -200,13 +209,6 @@ describe('sends errors to Bugsnag', () => {
200209 expect ( onNotify ) . toHaveBeenCalledWith ( res . error )
201210 } )
202211
203- test ( 'processes AbortErrors as handled' , async ( ) => {
204- const res = await sendErrorToBugsnag ( new error . AbortError ( 'In test' ) , 'expected_error' )
205- expect ( res . reported ) . toEqual ( true )
206- expect ( res . unhandled ) . toEqual ( false )
207- expect ( onNotify ) . toHaveBeenCalledWith ( res . error )
208- } )
209-
210212 test . each ( [ null , undefined , { } , { message : 'nope' } ] ) ( 'deals with strange things to throw %s' , async ( throwable ) => {
211213 const res = await sendErrorToBugsnag ( throwable , 'unexpected_error' )
212214 expect ( res . reported ) . toEqual ( false )
0 commit comments