@@ -93,6 +93,7 @@ describe('hubextensions', () => {
9393
9494 const transportSpy = jest . spyOn ( transport , 'send' ) . mockReturnValue ( Promise . resolve ( ) ) ;
9595
96+ // eslint-disable-next-line deprecation/deprecation
9697 const transaction = Sentry . getCurrentHub ( ) . startTransaction ( { name : 'profile_hub' } ) ;
9798 await wait ( 500 ) ;
9899 transaction . finish ( ) ;
@@ -127,11 +128,12 @@ describe('hubextensions', () => {
127128
128129 jest . spyOn ( transport , 'send' ) . mockReturnValue ( Promise . resolve ( ) ) ;
129130
131+ // eslint-disable-next-line deprecation/deprecation
130132 const transaction = Sentry . getCurrentHub ( ) . startTransaction ( { name : 'profile_hub' } ) ;
131133 transaction . finish ( ) ;
132134
133135 await Sentry . flush ( 1000 ) ;
134- expect ( logSpy . mock ?. lastCall ?. [ 0 ] ) . toBe ( '[Profiling] Discarding profile because it contains less than 2 samples' ) ;
136+ expect ( logSpy . mock ?. [ logSpy . mock . calls . length - 1 ] ?. [ 0 ] ) . toBe ( '[Profiling] Discarding profile because it contains less than 2 samples' ) ;
135137
136138 expect ( ( transport . send as any ) . mock . calls [ 0 ] [ 0 ] [ 1 ] [ 0 ] [ 0 ] . type ) . toBe ( 'transaction' ) ;
137139 // eslint-disable-next-line @typescript-eslint/unbound-method
@@ -169,6 +171,7 @@ describe('hubextensions', () => {
169171
170172 jest . spyOn ( transport , 'send' ) . mockReturnValue ( Promise . resolve ( ) ) ;
171173
174+ // eslint-disable-next-line deprecation/deprecation
172175 const transaction = Sentry . getCurrentHub ( ) . startTransaction ( { name : 'profile_hub' , traceId : 'boop' } ) ;
173176 await wait ( 500 ) ;
174177 transaction . finish ( ) ;
@@ -188,14 +191,15 @@ describe('hubextensions', () => {
188191
189192 jest . spyOn ( transport , 'send' ) . mockReturnValue ( Promise . resolve ( ) ) ;
190193
194+ // eslint-disable-next-line deprecation/deprecation
191195 const transaction = hub . startTransaction ( { name : 'profile_hub' } ) ;
192196 await wait ( 500 ) ;
193197 transaction . finish ( ) ;
194198
195199 await Sentry . flush ( 1000 ) ;
196200
197201 expect ( startProfilingSpy ) . toHaveBeenCalledTimes ( 1 ) ;
198- expect ( ( stopProfilingSpy . mock . lastCall ?. [ 0 ] as string ) . length ) . toBe ( 32 ) ;
202+ expect ( ( stopProfilingSpy . mock [ stopProfilingSpy . mock . calls . length - 1 ] ?. [ 0 ] as string ) . length ) . toBe ( 32 ) ;
199203 } ) ;
200204
201205 it ( 'sends profile in the same envelope as transaction' , async ( ) => {
@@ -205,6 +209,7 @@ describe('hubextensions', () => {
205209
206210 const transportSpy = jest . spyOn ( transport , 'send' ) . mockReturnValue ( Promise . resolve ( ) ) ;
207211
212+ // eslint-disable-next-line deprecation/deprecation
208213 const transaction = hub . startTransaction ( { name : 'profile_hub' } ) ;
209214 await wait ( 500 ) ;
210215 transaction . finish ( ) ;
@@ -252,6 +257,7 @@ describe('hubextensions', () => {
252257 return Promise . resolve ( ) ;
253258 } ) ;
254259
260+ // eslint-disable-next-line deprecation/deprecation
255261 const transaction = hub . startTransaction ( { name : 'profile_hub' } ) ;
256262 await wait ( 500 ) ;
257263 transaction . finish ( ) ;
@@ -271,6 +277,7 @@ describe('hubextensions', () => {
271277
272278 client . on ( 'preprocessEvent' , onPreprocessEvent ) ;
273279
280+ // eslint-disable-next-line deprecation/deprecation
274281 const transaction = hub . startTransaction ( { name : 'profile_hub' } ) ;
275282 await wait ( 500 ) ;
276283 transaction . finish ( ) ;
@@ -295,14 +302,15 @@ describe('hubextensions', () => {
295302 const startProfilingSpy = jest . spyOn ( CpuProfilerBindings , 'startProfiling' ) ;
296303 const stopProfilingSpy = jest . spyOn ( CpuProfilerBindings , 'stopProfiling' ) ;
297304
305+ // eslint-disable-next-line deprecation/deprecation
298306 const transaction = hub . startTransaction ( { name : 'profile_hub' } ) ;
299307 await wait ( 500 ) ;
300308 transaction . finish ( ) ;
301309
302310 await Sentry . flush ( 1000 ) ;
303311
304312 expect ( startProfilingSpy ) . toHaveBeenCalledTimes ( 1 ) ;
305- expect ( ( stopProfilingSpy . mock . lastCall ?. [ 0 ] as string ) . length ) . toBe ( 32 ) ;
313+ expect ( ( stopProfilingSpy . mock [ startProfilingSpy . mock . calls . length - 1 ] ?. [ 0 ] as string ) . length ) . toBe ( 32 ) ;
306314 } ) ;
307315
308316 it ( 'sends profile in separate envelope' , async ( ) => {
@@ -315,6 +323,7 @@ describe('hubextensions', () => {
315323 return Promise . resolve ( ) ;
316324 } ) ;
317325
326+ // eslint-disable-next-line deprecation/deprecation
318327 const transaction = hub . startTransaction ( { name : 'profile_hub' } ) ;
319328 await wait ( 500 ) ;
320329 transaction . finish ( ) ;
@@ -330,20 +339,21 @@ describe('hubextensions', () => {
330339 // it seems that in node 19 globals (or least part of them) are a readonly object
331340 // so when useFakeTimers is called it throws an error because it cannot override
332341 // a readonly property of performance on global object. Use legacyFakeTimers for now
333- jest . useFakeTimers ( { legacyFakeTimers : true } ) ;
342+ jest . useFakeTimers ( 'legacy' ) ;
334343 const startProfilingSpy = jest . spyOn ( CpuProfilerBindings , 'startProfiling' ) ;
335344 const stopProfilingSpy = jest . spyOn ( CpuProfilerBindings , 'stopProfiling' ) ;
336345
337346 const [ client ] = makeClientWithoutHooks ( ) ;
338347 const hub = Sentry . getCurrentHub ( ) ;
339348 hub . bindClient ( client ) ;
340349
350+ // eslint-disable-next-line deprecation/deprecation
341351 const transaction = Sentry . getCurrentHub ( ) . startTransaction ( { name : 'timeout_transaction' } ) ;
342352 expect ( startProfilingSpy ) . toHaveBeenCalledTimes ( 1 ) ;
343353 jest . advanceTimersByTime ( 30001 ) ;
344354
345355 expect ( stopProfilingSpy ) . toHaveBeenCalledTimes ( 1 ) ;
346- expect ( ( stopProfilingSpy . mock . lastCall ?. [ 0 ] as string ) . length ) . toBe ( 32 ) ;
356+ expect ( ( stopProfilingSpy . mock . calls [ startProfilingSpy . mock . calls . length - 1 ] ?. [ 0 ] as string ) . length ) . toBe ( 32 ) ;
347357
348358 transaction . finish ( ) ;
349359 expect ( stopProfilingSpy ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -357,6 +367,7 @@ describe('hubextensions', () => {
357367 const hub = Sentry . getCurrentHub ( ) ;
358368 hub . bindClient ( client ) ;
359369
370+ // eslint-disable-next-line deprecation/deprecation
360371 const transaction = Sentry . getCurrentHub ( ) . startTransaction ( { name : 'txn' } ) ;
361372 transaction . finish ( ) ;
362373 transaction . finish ( ) ;
@@ -398,6 +409,7 @@ describe('hubextensions', () => {
398409
399410 const transportSpy = jest . spyOn ( transport , 'send' ) . mockReturnValue ( Promise . resolve ( ) ) ;
400411
412+ // eslint-disable-next-line deprecation/deprecation
401413 const transaction = hub . startTransaction ( { name : 'profile_hub' } ) ;
402414 await wait ( 500 ) ;
403415 transaction . finish ( ) ;
0 commit comments