@@ -281,6 +281,37 @@ describe('Tests Native Wrapper', () => {
281
281
expect ( RNSentry . setContext ) . not . toBeCalled ( ) ;
282
282
expect ( RNSentry . setExtra ) . not . toBeCalled ( ) ;
283
283
} ) ;
284
+
285
+ test ( 'sets ignoreErrorsStr and ignoreErrorsRegex correctly when ignoreErrors contains strings and regex' , async ( ) => {
286
+ const regex1 = / f o o / ;
287
+ const regex2 = new RegExp ( 'bar' ) ;
288
+ await NATIVE . initNativeSdk ( {
289
+ dsn : 'test' ,
290
+ enableNative : true ,
291
+ ignoreErrors : [ 'string1' , regex1 , 'string2' , regex2 ] ,
292
+ devServerUrl : undefined ,
293
+ defaultSidecarUrl : undefined ,
294
+ mobileReplayOptions : undefined ,
295
+ } ) ;
296
+ expect ( RNSentry . initNativeSdk ) . toBeCalled ( ) ;
297
+ const initParameter = ( RNSentry . initNativeSdk as jest . MockedFunction < any > ) . mock . calls [ 0 ] [ 0 ] ;
298
+ expect ( initParameter . ignoreErrorsStr ) . toEqual ( [ 'string1' , 'string2' ] ) ;
299
+ expect ( initParameter . ignoreErrorsRegex ) . toEqual ( [ regex1 . source , regex2 . source ] ) ;
300
+ } ) ;
301
+
302
+ test ( 'does not set ignoreErrorsStr or ignoreErrorsRegex if ignoreErrors is not provided' , async ( ) => {
303
+ await NATIVE . initNativeSdk ( {
304
+ dsn : 'test' ,
305
+ enableNative : true ,
306
+ devServerUrl : undefined ,
307
+ defaultSidecarUrl : undefined ,
308
+ mobileReplayOptions : undefined ,
309
+ } ) ;
310
+ expect ( RNSentry . initNativeSdk ) . toBeCalled ( ) ;
311
+ const initParameter = ( RNSentry . initNativeSdk as jest . MockedFunction < any > ) . mock . calls [ 0 ] [ 0 ] ;
312
+ expect ( initParameter . ignoreErrorsStr ) . toBeUndefined ( ) ;
313
+ expect ( initParameter . ignoreErrorsRegex ) . toBeUndefined ( ) ;
314
+ } ) ;
284
315
} ) ;
285
316
286
317
describe ( 'sendEnvelope' , ( ) => {
0 commit comments