@@ -179,6 +179,17 @@ const MALFORMED_EVENT: Event = {
179
179
180
180
const TRANSACTION_EVENT : Event = {
181
181
message : 'transaction message' ,
182
+ transaction : 'transaction name' ,
183
+ type : 'transaction' ,
184
+ } ;
185
+
186
+ const TRANSACTION_EVENT_2 : Event = {
187
+ transaction : 'transaction name 2' ,
188
+ type : 'transaction' ,
189
+ } ;
190
+
191
+ const TRANSACTION_EVENT_3 : Event = {
192
+ transaction : 'other name' ,
182
193
type : 'transaction' ,
183
194
} ;
184
195
@@ -284,6 +295,58 @@ describe('InboundFilters', () => {
284
295
} ) ;
285
296
} ) ;
286
297
298
+ describe ( 'ignoreTransactions' , ( ) => {
299
+ it ( 'string filter with partial match' , ( ) => {
300
+ const eventProcessor = createInboundFiltersEventProcessor ( {
301
+ ignoreTransactions : [ 'name' ] ,
302
+ } ) ;
303
+ expect ( eventProcessor ( TRANSACTION_EVENT , { } ) ) . toBe ( null ) ;
304
+ } ) ;
305
+
306
+ it ( 'ignores error event for filtering' , ( ) => {
307
+ const eventProcessor = createInboundFiltersEventProcessor ( {
308
+ ignoreTransactions : [ 'capture' ] ,
309
+ } ) ;
310
+ expect ( eventProcessor ( MESSAGE_EVENT , { } ) ) . toBe ( MESSAGE_EVENT ) ;
311
+ } ) ;
312
+
313
+ it ( 'string filter with exact match' , ( ) => {
314
+ const eventProcessor = createInboundFiltersEventProcessor ( {
315
+ ignoreTransactions : [ 'transaction name' ] ,
316
+ } ) ;
317
+ expect ( eventProcessor ( TRANSACTION_EVENT , { } ) ) . toBe ( null ) ;
318
+ } ) ;
319
+
320
+ it ( 'regexp filter with partial match' , ( ) => {
321
+ const eventProcessor = createInboundFiltersEventProcessor ( {
322
+ ignoreTransactions : [ / n a m e / ] ,
323
+ } ) ;
324
+ expect ( eventProcessor ( TRANSACTION_EVENT , { } ) ) . toBe ( null ) ;
325
+ } ) ;
326
+
327
+ it ( 'regexp filter with exact match' , ( ) => {
328
+ const eventProcessor = createInboundFiltersEventProcessor ( {
329
+ ignoreTransactions : [ / ^ t r a n s a c t i o n n a m e $ / ] ,
330
+ } ) ;
331
+ expect ( eventProcessor ( TRANSACTION_EVENT , { } ) ) . toBe ( null ) ;
332
+ expect ( eventProcessor ( TRANSACTION_EVENT_2 , { } ) ) . toBe ( TRANSACTION_EVENT_2 ) ;
333
+ } ) ;
334
+
335
+ it ( 'can use multiple filters' , ( ) => {
336
+ const eventProcessor = createInboundFiltersEventProcessor ( {
337
+ ignoreTransactions : [ 'transaction name 2' , / t r a n s a c t i o n / ] ,
338
+ } ) ;
339
+ expect ( eventProcessor ( TRANSACTION_EVENT , { } ) ) . toBe ( null ) ;
340
+ expect ( eventProcessor ( TRANSACTION_EVENT_2 , { } ) ) . toBe ( null ) ;
341
+ expect ( eventProcessor ( TRANSACTION_EVENT_3 , { } ) ) . toBe ( TRANSACTION_EVENT_3 ) ;
342
+ } ) ;
343
+
344
+ it ( 'uses default filters' , ( ) => {
345
+ const eventProcessor = createInboundFiltersEventProcessor ( ) ;
346
+ expect ( eventProcessor ( TRANSACTION_EVENT , { } ) ) . toBe ( TRANSACTION_EVENT ) ;
347
+ } ) ;
348
+ } ) ;
349
+
287
350
describe ( 'denyUrls/allowUrls' , ( ) => {
288
351
it ( 'should filter captured message based on its stack trace using string filter' , ( ) => {
289
352
const eventProcessorDeny = createInboundFiltersEventProcessor ( {
0 commit comments