@@ -12,15 +12,14 @@ describe('getTraceMetaTags', () => {
1212
1313 const runner = createRunner ( __dirname , 'server.js' ) . start ( ) ;
1414
15- const response = await runner . makeRequest ( 'get' , '/test' , {
15+ const response = await runner . makeRequest < { response : string } > ( 'get' , '/test' , {
1616 headers : {
1717 'sentry-trace' : `${ traceId } -${ parentSpanId } -1` ,
1818 baggage : 'sentry-environment=production,sentry-sample_rand=0.42' ,
1919 } ,
2020 } ) ;
2121
22- // @ts -ignore - response is defined, types just don't reflect it
23- const html = response ?. response as unknown as string ;
22+ const html = response ?. response ;
2423
2524 expect ( html ) . toMatch ( / < m e t a n a m e = " s e n t r y - t r a c e " c o n t e n t = " c d 7 e e 7 a 6 f e 3 e b e 7 a b 9 c 3 2 7 1 5 5 9 b c 2 0 3 c - [ a - z 0 - 9 ] { 16 } - 1 " \/ > / ) ;
2625 expect ( html ) . toContain ( '<meta name="baggage" content="sentry-environment=production,sentry-sample_rand=0.42"/>' ) ;
@@ -29,12 +28,11 @@ describe('getTraceMetaTags', () => {
2928 test ( 'injects <meta> tags with new trace if no incoming headers' , async ( ) => {
3029 const runner = createRunner ( __dirname , 'server.js' ) . start ( ) ;
3130
32- const response = await runner . makeRequest ( 'get' , '/test' ) ;
31+ const response = await runner . makeRequest < { response : string } > ( 'get' , '/test' ) ;
3332
34- // @ts -ignore - response is defined, types just don't reflect it
35- const html = response ?. response as unknown as string ;
33+ const html = response ?. response ;
3634
37- const traceId = html . match ( / < m e t a n a m e = " s e n t r y - t r a c e " c o n t e n t = " ( [ a - z 0 - 9 ] { 32 } ) - [ a - z 0 - 9 ] { 16 } - 1 " \/ > / ) ?. [ 1 ] ;
35+ const traceId = html ? .match ( / < m e t a n a m e = " s e n t r y - t r a c e " c o n t e n t = " ( [ a - z 0 - 9 ] { 32 } ) - [ a - z 0 - 9 ] { 16 } - 1 " \/ > / ) ?. [ 1 ] ;
3836 expect ( traceId ) . not . toBeUndefined ( ) ;
3937
4038 expect ( html ) . toContain ( '<meta name="baggage"' ) ;
@@ -44,12 +42,11 @@ describe('getTraceMetaTags', () => {
4442 test ( 'injects <meta> tags with negative sampling decision if tracesSampleRate is 0' , async ( ) => {
4543 const runner = createRunner ( __dirname , 'server-tracesSampleRate-zero.js' ) . start ( ) ;
4644
47- const response = await runner . makeRequest ( 'get' , '/test' ) ;
45+ const response = await runner . makeRequest < { response : string } > ( 'get' , '/test' ) ;
4846
49- // @ts -ignore - response is defined, types just don't reflect it
50- const html = response ?. response as unknown as string ;
47+ const html = response ?. response ;
5148
52- const traceId = html . match ( / < m e t a n a m e = " s e n t r y - t r a c e " c o n t e n t = " ( [ a - z 0 - 9 ] { 32 } ) - [ a - z 0 - 9 ] { 16 } - 0 " \/ > / ) ?. [ 1 ] ;
49+ const traceId = html ? .match ( / < m e t a n a m e = " s e n t r y - t r a c e " c o n t e n t = " ( [ a - z 0 - 9 ] { 32 } ) - [ a - z 0 - 9 ] { 16 } - 0 " \/ > / ) ?. [ 1 ] ;
5350 expect ( traceId ) . not . toBeUndefined ( ) ;
5451
5552 expect ( html ) . toContain ( '<meta name="baggage"' ) ;
@@ -63,15 +60,14 @@ describe('getTraceMetaTags', () => {
6360
6461 const runner = createRunner ( __dirname , 'server-sdk-disabled.js' ) . start ( ) ;
6562
66- const response = await runner . makeRequest ( 'get' , '/test' , {
63+ const response = await runner . makeRequest < { response : string } > ( 'get' , '/test' , {
6764 headers : {
6865 'sentry-trace' : `${ traceId } -${ parentSpanId } -1` ,
6966 baggage : 'sentry-environment=production' ,
7067 } ,
7168 } ) ;
7269
73- // @ts -ignore - response is defined, types just don't reflect it
74- const html = response ?. response as unknown as string ;
70+ const html = response ?. response ;
7571
7672 expect ( html ) . not . toContain ( '"sentry-trace"' ) ;
7773 expect ( html ) . not . toContain ( '"baggage"' ) ;
0 commit comments