@@ -76,7 +76,7 @@ describe('_addMeasureSpans', () => {
7676 const startTime = 23 ;
7777 const duration = 356 ;
7878
79- _addMeasureSpans ( span , entry , startTime , duration , timeOrigin ) ;
79+ _addMeasureSpans ( span , entry , startTime , duration , timeOrigin , [ ] ) ;
8080
8181 expect ( spans ) . toHaveLength ( 1 ) ;
8282 expect ( spanToJSON ( spans [ 0 ] ! ) ) . toEqual (
@@ -112,10 +112,75 @@ describe('_addMeasureSpans', () => {
112112 const startTime = 23 ;
113113 const duration = - 50 ;
114114
115- _addMeasureSpans ( span , entry , startTime , duration , timeOrigin ) ;
115+ _addMeasureSpans ( span , entry , startTime , duration , timeOrigin , [ ] ) ;
116116
117117 expect ( spans ) . toHaveLength ( 0 ) ;
118118 } ) ;
119+
120+ it ( 'ignores performance spans that match ignorePerformanceApiSpans' , ( ) => {
121+ const pageloadSpan = new SentrySpan ( { op : 'pageload' , name : '/' , sampled : true } ) ;
122+ const spans : Span [ ] = [ ] ;
123+
124+ getClient ( ) ?. on ( 'spanEnd' , span => {
125+ spans . push ( span ) ;
126+ } ) ;
127+
128+ const entries : PerformanceEntry [ ] = [
129+ {
130+ entryType : 'measure' ,
131+ name : 'measure-pass' ,
132+ duration : 10 ,
133+ startTime : 12 ,
134+ toJSON : ( ) => ( { } ) ,
135+ } ,
136+ {
137+ entryType : 'measure' ,
138+ name : 'measure-ignore' ,
139+ duration : 10 ,
140+ startTime : 12 ,
141+ toJSON : ( ) => ( { } ) ,
142+ } ,
143+ {
144+ entryType : 'mark' ,
145+ name : 'mark-pass' ,
146+ duration : 0 ,
147+ startTime : 12 ,
148+ toJSON : ( ) => ( { } ) ,
149+ } ,
150+ {
151+ entryType : 'mark' ,
152+ name : 'mark-ignore' ,
153+ duration : 0 ,
154+ startTime : 12 ,
155+ toJSON : ( ) => ( { } ) ,
156+ } ,
157+ {
158+ entryType : 'paint' ,
159+ name : 'mark-ignore' ,
160+ duration : 0 ,
161+ startTime : 12 ,
162+ toJSON : ( ) => ( { } ) ,
163+ } ,
164+ ] ;
165+
166+ const timeOrigin = 100 ;
167+ const startTime = 23 ;
168+ const duration = 356 ;
169+
170+ entries . forEach ( e => {
171+ _addMeasureSpans ( pageloadSpan , e , startTime , duration , timeOrigin , [ 'measure-i' , / m a r k - i g n / ] ) ;
172+ } ) ;
173+
174+ expect ( spans ) . toHaveLength ( 3 ) ;
175+ expect ( spans . map ( spanToJSON ) ) . toEqual (
176+ expect . arrayContaining ( [
177+ expect . objectContaining ( { description : 'measure-pass' , op : 'measure' } ) ,
178+ expect . objectContaining ( { description : 'mark-pass' , op : 'mark' } ) ,
179+ // name matches but type is not (mark|measure) => should not be ignored
180+ expect . objectContaining ( { description : 'mark-ignore' , op : 'paint' } ) ,
181+ ] ) ,
182+ ) ;
183+ } ) ;
119184} ) ;
120185
121186describe ( '_addResourceSpans' , ( ) => {
0 commit comments