@@ -180,16 +180,16 @@ describe('InboundFilters', () => {
180
180
describe ( '_isSentryError' , ( ) => {
181
181
it ( 'should work as expected' , ( ) => {
182
182
const eventProcessor = createInboundFiltersEventProcessor ( ) ;
183
- expect ( eventProcessor ( MESSAGE_EVENT ) ) . toBe ( MESSAGE_EVENT ) ;
184
- expect ( eventProcessor ( EXCEPTION_EVENT ) ) . toBe ( EXCEPTION_EVENT ) ;
185
- expect ( eventProcessor ( SENTRY_EVENT ) ) . toBe ( null ) ;
183
+ expect ( eventProcessor ( MESSAGE_EVENT , { } ) ) . toBe ( MESSAGE_EVENT ) ;
184
+ expect ( eventProcessor ( EXCEPTION_EVENT , { } ) ) . toBe ( EXCEPTION_EVENT ) ;
185
+ expect ( eventProcessor ( SENTRY_EVENT , { } ) ) . toBe ( null ) ;
186
186
} ) ;
187
187
188
188
it ( 'should be configurable' , ( ) => {
189
189
const eventProcessor = createInboundFiltersEventProcessor ( { ignoreInternal : false } ) ;
190
- expect ( eventProcessor ( MESSAGE_EVENT ) ) . toBe ( MESSAGE_EVENT ) ;
191
- expect ( eventProcessor ( EXCEPTION_EVENT ) ) . toBe ( EXCEPTION_EVENT ) ;
192
- expect ( eventProcessor ( SENTRY_EVENT ) ) . toBe ( SENTRY_EVENT ) ;
190
+ expect ( eventProcessor ( MESSAGE_EVENT , { } ) ) . toBe ( MESSAGE_EVENT ) ;
191
+ expect ( eventProcessor ( EXCEPTION_EVENT , { } ) ) . toBe ( EXCEPTION_EVENT ) ;
192
+ expect ( eventProcessor ( SENTRY_EVENT , { } ) ) . toBe ( SENTRY_EVENT ) ;
193
193
} ) ;
194
194
} ) ;
195
195
@@ -198,29 +198,29 @@ describe('InboundFilters', () => {
198
198
const eventProcessor = createInboundFiltersEventProcessor ( {
199
199
ignoreErrors : [ 'capture' ] ,
200
200
} ) ;
201
- expect ( eventProcessor ( MESSAGE_EVENT ) ) . toBe ( null ) ;
201
+ expect ( eventProcessor ( MESSAGE_EVENT , { } ) ) . toBe ( null ) ;
202
202
} ) ;
203
203
204
204
it ( 'string filter with exact match' , ( ) => {
205
205
const eventProcessor = createInboundFiltersEventProcessor ( {
206
206
ignoreErrors : [ 'captureMessage' ] ,
207
207
} ) ;
208
- expect ( eventProcessor ( MESSAGE_EVENT ) ) . toBe ( null ) ;
208
+ expect ( eventProcessor ( MESSAGE_EVENT , { } ) ) . toBe ( null ) ;
209
209
} ) ;
210
210
211
211
it ( 'regexp filter with partial match' , ( ) => {
212
212
const eventProcessor = createInboundFiltersEventProcessor ( {
213
213
ignoreErrors : [ / c a p t u r e / ] ,
214
214
} ) ;
215
- expect ( eventProcessor ( MESSAGE_EVENT ) ) . toBe ( null ) ;
215
+ expect ( eventProcessor ( MESSAGE_EVENT , { } ) ) . toBe ( null ) ;
216
216
} ) ;
217
217
218
218
it ( 'regexp filter with exact match' , ( ) => {
219
219
const eventProcessor = createInboundFiltersEventProcessor ( {
220
220
ignoreErrors : [ / ^ c a p t u r e M e s s a g e $ / ] ,
221
221
} ) ;
222
- expect ( eventProcessor ( MESSAGE_EVENT ) ) . toBe ( null ) ;
223
- expect ( eventProcessor ( MESSAGE_EVENT_2 ) ) . toBe ( MESSAGE_EVENT_2 ) ;
222
+ expect ( eventProcessor ( MESSAGE_EVENT , { } ) ) . toBe ( null ) ;
223
+ expect ( eventProcessor ( MESSAGE_EVENT_2 , { } ) ) . toBe ( MESSAGE_EVENT_2 ) ;
224
224
} ) ;
225
225
226
226
it ( 'prefers message when both message and exception are available' , ( ) => {
@@ -231,42 +231,42 @@ describe('InboundFilters', () => {
231
231
...EXCEPTION_EVENT ,
232
232
...MESSAGE_EVENT ,
233
233
} ;
234
- expect ( eventProcessor ( event ) ) . toBe ( null ) ;
234
+ expect ( eventProcessor ( event , { } ) ) . toBe ( null ) ;
235
235
} ) ;
236
236
237
237
it ( 'can use multiple filters' , ( ) => {
238
238
const eventProcessor = createInboundFiltersEventProcessor ( {
239
239
ignoreErrors : [ 'captureMessage' , / S y n t a x E r r o r / ] ,
240
240
} ) ;
241
- expect ( eventProcessor ( MESSAGE_EVENT ) ) . toBe ( null ) ;
242
- expect ( eventProcessor ( EXCEPTION_EVENT ) ) . toBe ( null ) ;
241
+ expect ( eventProcessor ( MESSAGE_EVENT , { } ) ) . toBe ( null ) ;
242
+ expect ( eventProcessor ( EXCEPTION_EVENT , { } ) ) . toBe ( null ) ;
243
243
} ) ;
244
244
245
245
it ( 'uses default filters' , ( ) => {
246
246
const eventProcessor = createInboundFiltersEventProcessor ( ) ;
247
- expect ( eventProcessor ( SCRIPT_ERROR_EVENT ) ) . toBe ( null ) ;
247
+ expect ( eventProcessor ( SCRIPT_ERROR_EVENT , { } ) ) . toBe ( null ) ;
248
248
} ) ;
249
249
250
250
describe ( 'on exception' , ( ) => {
251
251
it ( 'uses exception data when message is unavailable' , ( ) => {
252
252
const eventProcessor = createInboundFiltersEventProcessor ( {
253
253
ignoreErrors : [ 'SyntaxError: unidentified ? at line 1337' ] ,
254
254
} ) ;
255
- expect ( eventProcessor ( EXCEPTION_EVENT ) ) . toBe ( null ) ;
255
+ expect ( eventProcessor ( EXCEPTION_EVENT , { } ) ) . toBe ( null ) ;
256
256
} ) ;
257
257
258
258
it ( 'can match on exception value' , ( ) => {
259
259
const eventProcessor = createInboundFiltersEventProcessor ( {
260
260
ignoreErrors : [ / u n i d e n t i f i e d \? / ] ,
261
261
} ) ;
262
- expect ( eventProcessor ( EXCEPTION_EVENT ) ) . toBe ( null ) ;
262
+ expect ( eventProcessor ( EXCEPTION_EVENT , { } ) ) . toBe ( null ) ;
263
263
} ) ;
264
264
265
265
it ( 'can match on exception type' , ( ) => {
266
266
const eventProcessor = createInboundFiltersEventProcessor ( {
267
267
ignoreErrors : [ / ^ S y n t a x E r r o r / ] ,
268
268
} ) ;
269
- expect ( eventProcessor ( EXCEPTION_EVENT ) ) . toBe ( null ) ;
269
+ expect ( eventProcessor ( EXCEPTION_EVENT , { } ) ) . toBe ( null ) ;
270
270
} ) ;
271
271
} ) ;
272
272
} ) ;
@@ -276,78 +276,78 @@ describe('InboundFilters', () => {
276
276
const eventProcessorDeny = createInboundFiltersEventProcessor ( {
277
277
denyUrls : [ 'https://awesome-analytics.io' ] ,
278
278
} ) ;
279
- expect ( eventProcessorDeny ( MESSAGE_EVENT_WITH_STACKTRACE ) ) . toBe ( null ) ;
279
+ expect ( eventProcessorDeny ( MESSAGE_EVENT_WITH_STACKTRACE , { } ) ) . toBe ( null ) ;
280
280
} ) ;
281
281
282
282
it ( 'should allow denyUrls to take precedence' , ( ) => {
283
283
const eventProcessorBoth = createInboundFiltersEventProcessor ( {
284
284
allowUrls : [ 'https://awesome-analytics.io' ] ,
285
285
denyUrls : [ 'https://awesome-analytics.io' ] ,
286
286
} ) ;
287
- expect ( eventProcessorBoth ( MESSAGE_EVENT_WITH_STACKTRACE ) ) . toBe ( null ) ;
287
+ expect ( eventProcessorBoth ( MESSAGE_EVENT_WITH_STACKTRACE , { } ) ) . toBe ( null ) ;
288
288
} ) ;
289
289
290
290
it ( 'should filter captured message based on its stack trace using regexp filter' , ( ) => {
291
291
const eventProcessorDeny = createInboundFiltersEventProcessor ( {
292
292
denyUrls : [ / a w e s o m e - a n a l y t i c s \. i o / ] ,
293
293
} ) ;
294
- expect ( eventProcessorDeny ( MESSAGE_EVENT_WITH_STACKTRACE ) ) . toBe ( null ) ;
294
+ expect ( eventProcessorDeny ( MESSAGE_EVENT_WITH_STACKTRACE , { } ) ) . toBe ( null ) ;
295
295
} ) ;
296
296
297
297
it ( 'should not filter captured messages with no stacktraces' , ( ) => {
298
298
const eventProcessor = createInboundFiltersEventProcessor ( {
299
299
denyUrls : [ 'https://awesome-analytics.io' ] ,
300
300
} ) ;
301
- expect ( eventProcessor ( MESSAGE_EVENT ) ) . toBe ( MESSAGE_EVENT ) ;
301
+ expect ( eventProcessor ( MESSAGE_EVENT , { } ) ) . toBe ( MESSAGE_EVENT ) ;
302
302
} ) ;
303
303
304
304
it ( 'should filter captured exception based on its stack trace using string filter' , ( ) => {
305
305
const eventProcessor = createInboundFiltersEventProcessor ( {
306
306
denyUrls : [ 'https://awesome-analytics.io' ] ,
307
307
} ) ;
308
- expect ( eventProcessor ( EXCEPTION_EVENT_WITH_FRAMES ) ) . toBe ( null ) ;
308
+ expect ( eventProcessor ( EXCEPTION_EVENT_WITH_FRAMES , { } ) ) . toBe ( null ) ;
309
309
} ) ;
310
310
311
311
it ( 'should filter captured exception based on its stack trace using regexp filter' , ( ) => {
312
312
const eventProcessor = createInboundFiltersEventProcessor ( {
313
313
denyUrls : [ / a w e s o m e - a n a l y t i c s \. i o / ] ,
314
314
} ) ;
315
- expect ( eventProcessor ( EXCEPTION_EVENT_WITH_FRAMES ) ) . toBe ( null ) ;
315
+ expect ( eventProcessor ( EXCEPTION_EVENT_WITH_FRAMES , { } ) ) . toBe ( null ) ;
316
316
} ) ;
317
317
318
318
it ( "should not filter events that don't match the filtered values" , ( ) => {
319
319
const eventProcessor = createInboundFiltersEventProcessor ( {
320
320
denyUrls : [ 'some-other-domain.com' ] ,
321
321
} ) ;
322
- expect ( eventProcessor ( EXCEPTION_EVENT_WITH_FRAMES ) ) . toBe ( EXCEPTION_EVENT_WITH_FRAMES ) ;
322
+ expect ( eventProcessor ( EXCEPTION_EVENT_WITH_FRAMES , { } ) ) . toBe ( EXCEPTION_EVENT_WITH_FRAMES ) ;
323
323
} ) ;
324
324
325
325
it ( 'should be able to use multiple filters' , ( ) => {
326
326
const eventProcessor = createInboundFiltersEventProcessor ( {
327
327
denyUrls : [ 'some-other-domain.com' , / a w e s o m e - a n a l y t i c s \. i o / ] ,
328
328
} ) ;
329
- expect ( eventProcessor ( EXCEPTION_EVENT_WITH_FRAMES ) ) . toBe ( null ) ;
329
+ expect ( eventProcessor ( EXCEPTION_EVENT_WITH_FRAMES , { } ) ) . toBe ( null ) ;
330
330
} ) ;
331
331
332
332
it ( 'should not fail with malformed event event' , ( ) => {
333
333
const eventProcessor = createInboundFiltersEventProcessor ( {
334
334
denyUrls : [ 'https://awesome-analytics.io' ] ,
335
335
} ) ;
336
- expect ( eventProcessor ( MALFORMED_EVENT ) ) . toBe ( MALFORMED_EVENT ) ;
336
+ expect ( eventProcessor ( MALFORMED_EVENT , { } ) ) . toBe ( MALFORMED_EVENT ) ;
337
337
} ) ;
338
338
339
339
it ( 'should search for script names when there is an anonymous callback at the last frame' , ( ) => {
340
340
const eventProcessor = createInboundFiltersEventProcessor ( {
341
341
denyUrls : [ 'https://awesome-analytics.io/some/file.js' ] ,
342
342
} ) ;
343
- expect ( eventProcessor ( MESSAGE_EVENT_WITH_ANON_LAST_FRAME ) ) . toBe ( null ) ;
343
+ expect ( eventProcessor ( MESSAGE_EVENT_WITH_ANON_LAST_FRAME , { } ) ) . toBe ( null ) ;
344
344
} ) ;
345
345
346
346
it ( 'should search for script names when the last frame is from native code' , ( ) => {
347
347
const eventProcessor = createInboundFiltersEventProcessor ( {
348
348
denyUrls : [ 'https://awesome-analytics.io/some/file.js' ] ,
349
349
} ) ;
350
- expect ( eventProcessor ( MESSAGE_EVENT_WITH_NATIVE_LAST_FRAME ) ) . toBe ( null ) ;
350
+ expect ( eventProcessor ( MESSAGE_EVENT_WITH_NATIVE_LAST_FRAME , { } ) ) . toBe ( null ) ;
351
351
} ) ;
352
352
} ) ;
353
353
} ) ;
0 commit comments