@@ -30,7 +30,7 @@ const mockTrace = vi.fn();
3030
3131const mockedBrowserTracing = {
3232 options : {
33- tracePropagationTargets : [ 'example.com' ] ,
33+ tracePropagationTargets : [ 'example.com' , / ^ \\ / ] ,
3434 traceFetch : true ,
3535 shouldCreateSpanForRequest : undefined as undefined | ( ( ) => boolean ) ,
3636 } ,
@@ -227,26 +227,23 @@ describe('wrapLoadWithSentry', () => {
227227 } ,
228228 } ,
229229 ] ,
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+ ] ,
246243 ] ) ( 'instruments fetch (%s)' , ( _ , originalFetchArgs , spanCtx ) => {
247244 beforeEach ( ( ) => {
248245 mockedBrowserTracing . options = {
249- tracePropagationTargets : [ 'example.com' ] ,
246+ tracePropagationTargets : [ 'example.com' , / ^ \/ / ] ,
250247 traceFetch : true ,
251248 shouldCreateSpanForRequest : undefined ,
252249 } ;
@@ -259,7 +256,7 @@ describe('wrapLoadWithSentry', () => {
259256 } ;
260257 } ;
261258
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 ( ) => {
263260 const wrappedLoad = wrapLoadWithSentry ( load ) ;
264261 await wrappedLoad ( MOCK_LOAD_ARGS ) ;
265262
0 commit comments