@@ -30,7 +30,7 @@ const mockTrace = vi.fn();
30
30
31
31
const mockedBrowserTracing = {
32
32
options : {
33
- tracePropagationTargets : [ 'example.com' ] ,
33
+ tracePropagationTargets : [ 'example.com' , / ^ \\ / ] ,
34
34
traceFetch : true ,
35
35
shouldCreateSpanForRequest : undefined as undefined | ( ( ) => boolean ) ,
36
36
} ,
@@ -227,26 +227,23 @@ describe('wrapLoadWithSentry', () => {
227
227
} ,
228
228
} ,
229
229
] ,
230
- // TODO: This case currently fails because we don't handle the Request API correctly.
231
- // We need to fix this in our core fetch instrumentation and
232
- // and adjust the test here as well, since both instrumentations
233
- // rely on the same `getFetchUrl` and `getFetchMethod` utility functions.
234
- // [
235
- // 'fetch call with a Request object ',
236
- // [{ url: 'api/users?id=123', headers: { 'x-my-header': 'value' } } as unknown as Request],
237
- // {
238
- // op: 'http.client',
239
- // name: 'GET [object Object]',
240
- // data: {
241
- // method: 'GET',
242
- // url: '[object Object]',
243
- // },
244
- // },
245
- // ],
230
+ [
231
+ 'fetch call with a Request object ' ,
232
+ [ { url : '/api/users?id=123' , headers : { 'x-my-header' : 'value' } } as unknown as Request ] ,
233
+ {
234
+ op : 'http.client' ,
235
+ name : 'GET /api/users' ,
236
+ data : {
237
+ method : 'GET' ,
238
+ url : '/api/users' ,
239
+ 'http.query' : 'id=123' ,
240
+ } ,
241
+ } ,
242
+ ] ,
246
243
] ) ( 'instruments fetch (%s)' , ( _ , originalFetchArgs , spanCtx ) => {
247
244
beforeEach ( ( ) => {
248
245
mockedBrowserTracing . options = {
249
- tracePropagationTargets : [ 'example.com' ] ,
246
+ tracePropagationTargets : [ 'example.com' , / ^ \/ / ] ,
250
247
traceFetch : true ,
251
248
shouldCreateSpanForRequest : undefined ,
252
249
} ;
@@ -259,7 +256,7 @@ describe('wrapLoadWithSentry', () => {
259
256
} ;
260
257
} ;
261
258
262
- it ( 'creates a fetch span and attaches tracing headers if event.fetch was called' , async ( ) => {
259
+ it ( 'creates a fetch span and attaches tracing headers by default when event.fetch was called' , async ( ) => {
263
260
const wrappedLoad = wrapLoadWithSentry ( load ) ;
264
261
await wrappedLoad ( MOCK_LOAD_ARGS ) ;
265
262
0 commit comments