1+ import { expect , test } from 'vitest' ;
12import { createRunner } from '../../../../utils/runner' ;
23import { createTestServer } from '../../../../utils/server' ;
34
4- test ( 'outgoing http requests are correctly instrumented with tracing & spans disabled' , done => {
5+ test ( 'outgoing http requests are correctly instrumented with tracing & spans disabled' , async ( ) => {
56 expect . assertions ( 11 ) ;
67
7- createTestServer ( done )
8+ const [ SERVER_URL , closeTestServer ] = await createTestServer ( )
89 . get ( '/api/v0' , headers => {
910 expect ( headers [ 'sentry-trace' ] ) . toEqual ( expect . stringMatching ( / ^ ( [ a - f 0 - 9 ] { 32 } ) - ( [ a - f 0 - 9 ] { 16 } ) $ / ) ) ;
1011 expect ( headers [ 'sentry-trace' ] ) . not . toEqual ( '00000000000000000000000000000000-0000000000000000' ) ;
@@ -23,73 +24,75 @@ test('outgoing http requests are correctly instrumented with tracing & spans dis
2324 expect ( headers [ 'baggage' ] ) . toBeUndefined ( ) ;
2425 expect ( headers [ 'sentry-trace' ] ) . toBeUndefined ( ) ;
2526 } )
26- . start ( )
27- . then ( ( [ SERVER_URL , closeTestServer ] ) => {
28- createRunner ( __dirname , 'scenario.ts' )
29- . withEnv ( { SERVER_URL } )
30- . ensureNoErrorOutput ( )
31- . expect ( {
32- event : {
33- exception : {
34- values : [
35- {
36- type : 'Error' ,
37- value : 'foo' ,
38- } ,
39- ] ,
27+ . start ( ) ;
28+
29+ await createRunner ( __dirname , 'scenario.ts' )
30+ . withEnv ( { SERVER_URL } )
31+ . ensureNoErrorOutput ( )
32+ . expect ( {
33+ event : {
34+ exception : {
35+ values : [
36+ {
37+ type : 'Error' ,
38+ value : 'foo' ,
39+ } ,
40+ ] ,
41+ } ,
42+ breadcrumbs : [
43+ {
44+ message : 'manual breadcrumb' ,
45+ timestamp : expect . any ( Number ) ,
46+ } ,
47+ {
48+ category : 'http' ,
49+ data : {
50+ 'http.method' : 'GET' ,
51+ url : `${ SERVER_URL } /api/v0` ,
52+ status_code : 200 ,
53+ ADDED_PATH : '/api/v0' ,
4054 } ,
41- breadcrumbs : [
42- {
43- message : 'manual breadcrumb' ,
44- timestamp : expect . any ( Number ) ,
45- } ,
46- {
47- category : 'http' ,
48- data : {
49- 'http.method' : 'GET' ,
50- url : `${ SERVER_URL } /api/v0` ,
51- status_code : 200 ,
52- ADDED_PATH : '/api/v0' ,
53- } ,
54- timestamp : expect . any ( Number ) ,
55- type : 'http' ,
56- } ,
57- {
58- category : 'http' ,
59- data : {
60- 'http.method' : 'GET' ,
61- url : `${ SERVER_URL } /api/v1` ,
62- status_code : 200 ,
63- ADDED_PATH : '/api/v1' ,
64- } ,
65- timestamp : expect . any ( Number ) ,
66- type : 'http' ,
67- } ,
68- {
69- category : 'http' ,
70- data : {
71- 'http.method' : 'GET' ,
72- url : `${ SERVER_URL } /api/v2` ,
73- status_code : 200 ,
74- ADDED_PATH : '/api/v2' ,
75- } ,
76- timestamp : expect . any ( Number ) ,
77- type : 'http' ,
78- } ,
79- {
80- category : 'http' ,
81- data : {
82- 'http.method' : 'GET' ,
83- url : `${ SERVER_URL } /api/v3` ,
84- status_code : 200 ,
85- ADDED_PATH : '/api/v3' ,
86- } ,
87- timestamp : expect . any ( Number ) ,
88- type : 'http' ,
89- } ,
90- ] ,
55+ timestamp : expect . any ( Number ) ,
56+ type : 'http' ,
9157 } ,
92- } )
93- . start ( closeTestServer ) ;
94- } ) ;
58+ {
59+ category : 'http' ,
60+ data : {
61+ 'http.method' : 'GET' ,
62+ url : `${ SERVER_URL } /api/v1` ,
63+ status_code : 200 ,
64+ ADDED_PATH : '/api/v1' ,
65+ } ,
66+ timestamp : expect . any ( Number ) ,
67+ type : 'http' ,
68+ } ,
69+ {
70+ category : 'http' ,
71+ data : {
72+ 'http.method' : 'GET' ,
73+ url : `${ SERVER_URL } /api/v2` ,
74+ status_code : 200 ,
75+ ADDED_PATH : '/api/v2' ,
76+ } ,
77+ timestamp : expect . any ( Number ) ,
78+ type : 'http' ,
79+ } ,
80+ {
81+ category : 'http' ,
82+ data : {
83+ 'http.method' : 'GET' ,
84+ url : `${ SERVER_URL } /api/v3` ,
85+ status_code : 200 ,
86+ ADDED_PATH : '/api/v3' ,
87+ } ,
88+ timestamp : expect . any ( Number ) ,
89+ type : 'http' ,
90+ } ,
91+ ] ,
92+ } ,
93+ } )
94+ . start ( )
95+ . completed ( ) ;
96+
97+ closeTestServer ( ) ;
9598} ) ;
0 commit comments