1
1
import { spawn } from 'child_process' ;
2
2
import { join } from 'path' ;
3
- import type { Envelope , Event , SerializedSession } from '@sentry/types' ;
3
+ import type { Envelope , EnvelopeItemType , Event , SerializedSession } from '@sentry/types' ;
4
4
5
5
export function assertSentryEvent ( actual : Event , expected : Event ) : void {
6
6
expect ( actual ) . toMatchObject ( {
@@ -34,6 +34,7 @@ export function createRunner(...paths: string[]) {
34
34
35
35
const expectedEnvelopes : Expected [ ] = [ ] ;
36
36
const flags : string [ ] = [ ] ;
37
+ const ignored : EnvelopeItemType [ ] = [ ] ;
37
38
let hasExited = false ;
38
39
39
40
if ( testPath . endsWith ( '.ts' ) ) {
@@ -49,6 +50,10 @@ export function createRunner(...paths: string[]) {
49
50
flags . push ( ...args ) ;
50
51
return this ;
51
52
} ,
53
+ ignore : function ( ...types : EnvelopeItemType [ ] ) {
54
+ ignored . push ( ...types ) ;
55
+ return this ;
56
+ } ,
52
57
start : function ( done ?: ( e ?: unknown ) => void ) {
53
58
const expectedEnvelopeCount = expectedEnvelopes . length ;
54
59
let envelopeCount = 0 ;
@@ -94,6 +99,10 @@ export function createRunner(...paths: string[]) {
94
99
for ( const item of envelope [ 1 ] ) {
95
100
const envelopeItemType = item [ 0 ] . type ;
96
101
102
+ if ( ignored . includes ( envelopeItemType ) ) {
103
+ continue ;
104
+ }
105
+
97
106
const expected = expectedEnvelopes . shift ( ) ;
98
107
99
108
// Catch any error or failed assertions and pass them to done
0 commit comments