99 getMainCarrier ,
1010 mergeScopeData ,
1111 setCurrentClient ,
12+ spanIsSampled ,
1213 spanToJSON ,
1314 withScope ,
1415} from '@sentry/core' ;
@@ -289,7 +290,7 @@ describe('tracingHandler', () => {
289290
290291 sentryTracingMiddleware ( req , res , next ) ;
291292
292- const transaction = ( res as any ) . __sentry_transaction ;
293+ const transaction = ( res as any ) . __sentry_transaction as Transaction ;
293294
294295 expect ( getPropagationContext ( ) ) . toEqual ( {
295296 traceId : '12312012123120121231201212312012' ,
@@ -300,9 +301,10 @@ describe('tracingHandler', () => {
300301 } ) ;
301302
302303 // since we have no tracesSampler defined, the default behavior (inherit if possible) applies
303- expect ( transaction . traceId ) . toEqual ( '12312012123120121231201212312012' ) ;
304- expect ( transaction . parentSpanId ) . toEqual ( '1121201211212012' ) ;
305- expect ( transaction . sampled ) . toEqual ( false ) ;
304+ expect ( transaction . spanContext ( ) . traceId ) . toEqual ( '12312012123120121231201212312012' ) ;
305+ expect ( spanToJSON ( transaction ) . parent_span_id ) . toEqual ( '1121201211212012' ) ;
306+ expect ( spanIsSampled ( transaction ) ) . toEqual ( false ) ;
307+ // eslint-disable-next-line deprecation/deprecation
306308 expect ( transaction . metadata ?. dynamicSamplingContext ) . toStrictEqual ( { } ) ;
307309 } ) ;
308310
@@ -322,12 +324,13 @@ describe('tracingHandler', () => {
322324 dsc : { version : '1.0' , environment : 'production' } ,
323325 } ) ;
324326
325- const transaction = ( res as any ) . __sentry_transaction ;
327+ const transaction = ( res as any ) . __sentry_transaction as Transaction ;
326328
327329 // since we have no tracesSampler defined, the default behavior (inherit if possible) applies
328- expect ( transaction . traceId ) . toEqual ( '12312012123120121231201212312012' ) ;
329- expect ( transaction . parentSpanId ) . toEqual ( '1121201211212012' ) ;
330- expect ( transaction . sampled ) . toEqual ( true ) ;
330+ expect ( transaction . spanContext ( ) . traceId ) . toEqual ( '12312012123120121231201212312012' ) ;
331+ expect ( spanToJSON ( transaction ) . parent_span_id ) . toEqual ( '1121201211212012' ) ;
332+ expect ( spanIsSampled ( transaction ) ) . toEqual ( true ) ;
333+ // eslint-disable-next-line deprecation/deprecation
331334 expect ( transaction . metadata ?. dynamicSamplingContext ) . toStrictEqual ( { version : '1.0' , environment : 'production' } ) ;
332335 } ) ;
333336
@@ -341,7 +344,8 @@ describe('tracingHandler', () => {
341344
342345 expect ( getPropagationContext ( ) . dsc ) . toEqual ( { version : '1.0' , environment : 'production' } ) ;
343346
344- const transaction = ( res as any ) . __sentry_transaction ;
347+ const transaction = ( res as any ) . __sentry_transaction as Transaction ;
348+ // eslint-disable-next-line deprecation/deprecation
345349 expect ( transaction . metadata ?. dynamicSamplingContext ) . toStrictEqual ( { version : '1.0' , environment : 'production' } ) ;
346350 } ) ;
347351
@@ -364,7 +368,7 @@ describe('tracingHandler', () => {
364368 it ( 'puts its transaction on the response object' , ( ) => {
365369 sentryTracingMiddleware ( req , res , next ) ;
366370
367- const transaction = ( res as any ) . __sentry_transaction ;
371+ const transaction = ( res as any ) . __sentry_transaction as Transaction ;
368372
369373 expect ( transaction ) . toBeDefined ( ) ;
370374
@@ -396,7 +400,7 @@ describe('tracingHandler', () => {
396400
397401 sentryTracingMiddleware ( req , res , next ) ;
398402
399- const transaction = ( res as any ) . __sentry_transaction ;
403+ const transaction = ( res as any ) . __sentry_transaction as Transaction ;
400404
401405 expect ( spanToJSON ( transaction ) . description ) . toBe ( `${ method . toUpperCase ( ) } ${ path } ` ) ;
402406 } ) ;
@@ -406,7 +410,7 @@ describe('tracingHandler', () => {
406410
407411 sentryTracingMiddleware ( req , res , next ) ;
408412
409- const transaction = ( res as any ) . __sentry_transaction ;
413+ const transaction = ( res as any ) . __sentry_transaction as Transaction ;
410414
411415 expect ( spanToJSON ( transaction ) . description ) . toBe ( `${ method . toUpperCase ( ) } ${ path } ` ) ;
412416 } ) ;
@@ -416,7 +420,7 @@ describe('tracingHandler', () => {
416420
417421 sentryTracingMiddleware ( req , res , next ) ;
418422
419- const transaction = ( res as any ) . __sentry_transaction ;
423+ const transaction = ( res as any ) . __sentry_transaction as Transaction ;
420424
421425 expect ( spanToJSON ( transaction ) . description ) . toBe ( `${ method . toUpperCase ( ) } ${ path } ` ) ;
422426 } ) ;
0 commit comments