9
9
getMainCarrier ,
10
10
mergeScopeData ,
11
11
setCurrentClient ,
12
+ spanIsSampled ,
12
13
spanToJSON ,
13
14
withScope ,
14
15
} from '@sentry/core' ;
@@ -322,12 +323,13 @@ describe('tracingHandler', () => {
322
323
dsc : { version : '1.0' , environment : 'production' } ,
323
324
} ) ;
324
325
325
- const transaction = ( res as any ) . __sentry_transaction ;
326
+ const transaction = ( res as any ) . __sentry_transaction as Transaction ;
326
327
327
328
// 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 ) ;
329
+ expect ( transaction . spanContext ( ) . traceId ) . toEqual ( '12312012123120121231201212312012' ) ;
330
+ expect ( spanToJSON ( transaction ) . parent_span_id ) . toEqual ( '1121201211212012' ) ;
331
+ expect ( spanIsSampled ( transaction ) ) . toEqual ( true ) ;
332
+ // eslint-disable-next-line deprecation/deprecation
331
333
expect ( transaction . metadata ?. dynamicSamplingContext ) . toStrictEqual ( { version : '1.0' , environment : 'production' } ) ;
332
334
} ) ;
333
335
@@ -341,7 +343,8 @@ describe('tracingHandler', () => {
341
343
342
344
expect ( getPropagationContext ( ) . dsc ) . toEqual ( { version : '1.0' , environment : 'production' } ) ;
343
345
344
- const transaction = ( res as any ) . __sentry_transaction ;
346
+ const transaction = ( res as any ) . __sentry_transaction as Transaction ;
347
+ // eslint-disable-next-line deprecation/deprecation
345
348
expect ( transaction . metadata ?. dynamicSamplingContext ) . toStrictEqual ( { version : '1.0' , environment : 'production' } ) ;
346
349
} ) ;
347
350
@@ -364,7 +367,7 @@ describe('tracingHandler', () => {
364
367
it ( 'puts its transaction on the response object' , ( ) => {
365
368
sentryTracingMiddleware ( req , res , next ) ;
366
369
367
- const transaction = ( res as any ) . __sentry_transaction ;
370
+ const transaction = ( res as any ) . __sentry_transaction as Transaction ;
368
371
369
372
expect ( transaction ) . toBeDefined ( ) ;
370
373
@@ -396,7 +399,7 @@ describe('tracingHandler', () => {
396
399
397
400
sentryTracingMiddleware ( req , res , next ) ;
398
401
399
- const transaction = ( res as any ) . __sentry_transaction ;
402
+ const transaction = ( res as any ) . __sentry_transaction as Transaction ;
400
403
401
404
expect ( spanToJSON ( transaction ) . description ) . toBe ( `${ method . toUpperCase ( ) } ${ path } ` ) ;
402
405
} ) ;
@@ -406,7 +409,7 @@ describe('tracingHandler', () => {
406
409
407
410
sentryTracingMiddleware ( req , res , next ) ;
408
411
409
- const transaction = ( res as any ) . __sentry_transaction ;
412
+ const transaction = ( res as any ) . __sentry_transaction as Transaction ;
410
413
411
414
expect ( spanToJSON ( transaction ) . description ) . toBe ( `${ method . toUpperCase ( ) } ${ path } ` ) ;
412
415
} ) ;
@@ -416,7 +419,7 @@ describe('tracingHandler', () => {
416
419
417
420
sentryTracingMiddleware ( req , res , next ) ;
418
421
419
- const transaction = ( res as any ) . __sentry_transaction ;
422
+ const transaction = ( res as any ) . __sentry_transaction as Transaction ;
420
423
421
424
expect ( spanToJSON ( transaction ) . description ) . toBe ( `${ method . toUpperCase ( ) } ${ path } ` ) ;
422
425
} ) ;
0 commit comments