@@ -15,8 +15,8 @@ let hub: Hub;
15
15
let fetch : typeof FetchType ;
16
16
17
17
beforeAll ( async ( ) => {
18
- await setupTestServer ( ) ;
19
18
try {
19
+ await setupTestServer ( ) ;
20
20
// need to conditionally require `undici` because it's not available in Node 10
21
21
// eslint-disable-next-line @typescript-eslint/no-var-requires
22
22
fetch = require ( 'undici' ) . fetch ;
@@ -51,10 +51,10 @@ conditionalTest({ min: 16 })('Undici integration', () => {
51
51
it . each ( [
52
52
[
53
53
'simple url' ,
54
- 'http://localhost:18099 ' ,
54
+ 'http://localhost:18100 ' ,
55
55
undefined ,
56
56
{
57
- description : 'GET http://localhost:18099 /' ,
57
+ description : 'GET http://localhost:18100 /' ,
58
58
op : 'http.client' ,
59
59
data : expect . objectContaining ( {
60
60
'http.method' : 'GET' ,
@@ -63,10 +63,10 @@ conditionalTest({ min: 16 })('Undici integration', () => {
63
63
] ,
64
64
[
65
65
'url with query' ,
66
- 'http://localhost:18099 ?foo=bar' ,
66
+ 'http://localhost:18100 ?foo=bar' ,
67
67
undefined ,
68
68
{
69
- description : 'GET http://localhost:18099 /' ,
69
+ description : 'GET http://localhost:18100 /' ,
70
70
op : 'http.client' ,
71
71
data : expect . objectContaining ( {
72
72
'http.method' : 'GET' ,
@@ -76,32 +76,32 @@ conditionalTest({ min: 16 })('Undici integration', () => {
76
76
] ,
77
77
[
78
78
'url with POST method' ,
79
- 'http://localhost:18099 ' ,
79
+ 'http://localhost:18100 ' ,
80
80
{ method : 'POST' } ,
81
81
{
82
- description : 'POST http://localhost:18099 /' ,
82
+ description : 'POST http://localhost:18100 /' ,
83
83
data : expect . objectContaining ( {
84
84
'http.method' : 'POST' ,
85
85
} ) ,
86
86
} ,
87
87
] ,
88
88
[
89
89
'url with POST method' ,
90
- 'http://localhost:18099 ' ,
90
+ 'http://localhost:18100 ' ,
91
91
{ method : 'POST' } ,
92
92
{
93
- description : 'POST http://localhost:18099 /' ,
93
+ description : 'POST http://localhost:18100 /' ,
94
94
data : expect . objectContaining ( {
95
95
'http.method' : 'POST' ,
96
96
} ) ,
97
97
} ,
98
98
] ,
99
99
[
100
100
'url with GET as default' ,
101
- 'http://localhost:18099 ' ,
101
+ 'http://localhost:18100 ' ,
102
102
{ method : undefined } ,
103
103
{
104
- description : 'GET http://localhost:18099 /' ,
104
+ description : 'GET http://localhost:18100 /' ,
105
105
} ,
106
106
] ,
107
107
] ) ( 'creates a span with a %s' , async ( _ : string , request , requestInit , expected ) => {
@@ -182,11 +182,11 @@ conditionalTest({ min: 16 })('Undici integration', () => {
182
182
183
183
const undoPatch = patchUndici ( { shouldCreateSpanForRequest : url => url . includes ( 'yes' ) } ) ;
184
184
185
- await fetch ( 'http://localhost:18099 /no' , { method : 'POST' } ) ;
185
+ await fetch ( 'http://localhost:18100 /no' , { method : 'POST' } ) ;
186
186
187
187
expect ( transaction . spanRecorder ?. spans . length ) . toBe ( 1 ) ;
188
188
189
- await fetch ( 'http://localhost:18099 /yes' , { method : 'POST' } ) ;
189
+ await fetch ( 'http://localhost:18100 /yes' , { method : 'POST' } ) ;
190
190
191
191
expect ( transaction . spanRecorder ?. spans . length ) . toBe ( 2 ) ;
192
192
@@ -200,7 +200,7 @@ conditionalTest({ min: 16 })('Undici integration', () => {
200
200
const transaction = hub . startTransaction ( { name : 'test-transaction' } ) as Transaction ;
201
201
hub . getScope ( ) . setSpan ( transaction ) ;
202
202
203
- await fetch ( 'http://localhost:18099 ' , { method : 'POST' } ) ;
203
+ await fetch ( 'http://localhost:18100 ' , { method : 'POST' } ) ;
204
204
205
205
expect ( transaction . spanRecorder ?. spans . length ) . toBe ( 2 ) ;
206
206
const span = transaction . spanRecorder ?. spans [ 1 ] ;
@@ -215,7 +215,7 @@ conditionalTest({ min: 16 })('Undici integration', () => {
215
215
it ( 'attaches the sentry trace and baggage headers if there is no active span' , async ( ) => {
216
216
const scope = hub . getScope ( ) ;
217
217
218
- await fetch ( 'http://localhost:18099 ' , { method : 'POST' } ) ;
218
+ await fetch ( 'http://localhost:18100 ' , { method : 'POST' } ) ;
219
219
220
220
const propagationContext = scope . getPropagationContext ( ) ;
221
221
@@ -234,15 +234,15 @@ conditionalTest({ min: 16 })('Undici integration', () => {
234
234
235
235
const undoPatch = patchUndici ( { shouldCreateSpanForRequest : url => url . includes ( 'yes' ) } ) ;
236
236
237
- await fetch ( 'http://localhost:18099 /no' , { method : 'POST' } ) ;
237
+ await fetch ( 'http://localhost:18100 /no' , { method : 'POST' } ) ;
238
238
239
239
expect ( requestHeaders [ 'sentry-trace' ] ) . toBeDefined ( ) ;
240
240
expect ( requestHeaders [ 'baggage' ] ) . toBeDefined ( ) ;
241
241
242
242
expect ( requestHeaders [ 'sentry-trace' ] . includes ( propagationContext . traceId ) ) . toBe ( true ) ;
243
243
const firstSpanId = requestHeaders [ 'sentry-trace' ] . split ( '-' ) [ 1 ] ;
244
244
245
- await fetch ( 'http://localhost:18099 /yes' , { method : 'POST' } ) ;
245
+ await fetch ( 'http://localhost:18100 /yes' , { method : 'POST' } ) ;
246
246
247
247
expect ( requestHeaders [ 'sentry-trace' ] ) . toBeDefined ( ) ;
248
248
expect ( requestHeaders [ 'baggage' ] ) . toBeDefined ( ) ;
@@ -264,14 +264,14 @@ conditionalTest({ min: 16 })('Undici integration', () => {
264
264
265
265
expect ( transaction . spanRecorder ?. spans . length ) . toBe ( 1 ) ;
266
266
267
- await fetch ( 'http://localhost:18099 /no' , { method : 'POST' } ) ;
267
+ await fetch ( 'http://localhost:18100 /no' , { method : 'POST' } ) ;
268
268
269
269
expect ( transaction . spanRecorder ?. spans . length ) . toBe ( 2 ) ;
270
270
271
271
expect ( requestHeaders [ 'sentry-trace' ] ) . toBeUndefined ( ) ;
272
272
expect ( requestHeaders [ 'baggage' ] ) . toBeUndefined ( ) ;
273
273
274
- await fetch ( 'http://localhost:18099 /yes' , { method : 'POST' } ) ;
274
+ await fetch ( 'http://localhost:18100 /yes' , { method : 'POST' } ) ;
275
275
276
276
expect ( transaction . spanRecorder ?. spans . length ) . toBe ( 3 ) ;
277
277
@@ -290,7 +290,7 @@ conditionalTest({ min: 16 })('Undici integration', () => {
290
290
data : {
291
291
method : 'POST' ,
292
292
status_code : 200 ,
293
- url : 'http://localhost:18099 /' ,
293
+ url : 'http://localhost:18100 /' ,
294
294
} ,
295
295
type : 'http' ,
296
296
timestamp : expect . any ( Number ) ,
@@ -300,7 +300,7 @@ conditionalTest({ min: 16 })('Undici integration', () => {
300
300
} ) ;
301
301
hub . bindClient ( client ) ;
302
302
303
- await fetch ( 'http://localhost:18099 ' , { method : 'POST' } ) ;
303
+ await fetch ( 'http://localhost:18100 ' , { method : 'POST' } ) ;
304
304
} ) ;
305
305
306
306
it ( 'adds a breadcrumb on errored request' , async ( ) => {
@@ -336,7 +336,7 @@ conditionalTest({ min: 16 })('Undici integration', () => {
336
336
337
337
const undoPatch = patchUndici ( { breadcrumbs : false } ) ;
338
338
339
- await fetch ( 'http://localhost:18099 ' , { method : 'POST' } ) ;
339
+ await fetch ( 'http://localhost:18100 ' , { method : 'POST' } ) ;
340
340
341
341
undoPatch ( ) ;
342
342
} ) ;
@@ -382,7 +382,7 @@ function setupTestServer() {
382
382
res . connection ?. end ( ) ;
383
383
} ) ;
384
384
385
- testServer ?. listen ( 18099 , 'localhost' ) ;
385
+ testServer ?. listen ( 18100 ) ;
386
386
387
387
return new Promise ( resolve => {
388
388
testServer ?. on ( 'listening' , resolve ) ;
0 commit comments