@@ -40,7 +40,6 @@ describe('browserTracingIntegration', () => {
4040        ...txnCtx , 
4141        updateName : vi . fn ( ) , 
4242        setAttribute : vi . fn ( ) , 
43-         setTag : vi . fn ( ) , 
4443      } ; 
4544      return  createdRootSpan ; 
4645    } ) ; 
@@ -52,7 +51,6 @@ describe('browserTracingIntegration', () => {
5251        ...txnCtx , 
5352        updateName : vi . fn ( ) , 
5453        setAttribute : vi . fn ( ) , 
55-         setTag : vi . fn ( ) , 
5654      } ; 
5755      return  createdRootSpan ; 
5856    } ) ; 
@@ -138,6 +136,29 @@ describe('browserTracingIntegration', () => {
138136    expect ( startBrowserTracingPageLoadSpanSpy ) . toHaveBeenCalledTimes ( 0 ) ; 
139137  } ) ; 
140138
139+   it ( "updates the current scope's transactionName once it's resolved during pageload" ,  ( )  =>  { 
140+     const  scopeSetTransactionNameSpy  =  vi . fn ( ) ; 
141+ 
142+     // @ts -expect-error - only returning a partial scope here, that's fine 
143+     vi . spyOn ( SentrySvelte ,  'getCurrentScope' ) . mockImplementation ( ( )  =>  { 
144+       return  { 
145+         setTransactionName : scopeSetTransactionNameSpy , 
146+       } ; 
147+     } ) ; 
148+ 
149+     const  integration  =  browserTracingIntegration ( ) ; 
150+     // @ts -expect-error - the fakeClient doesn't satisfy Client but that's fine 
151+     integration . afterAllSetup ( fakeClient ) ; 
152+ 
153+     // We emit an update to the `page` store to simulate the SvelteKit router lifecycle 
154+     // @ts -expect-error - page is a writable but the types say it's just readable 
155+     page . set ( {  route : {  id : 'testRoute/:id'  }  } ) ; 
156+ 
157+     // This should update the transaction name with the parameterized route: 
158+     expect ( scopeSetTransactionNameSpy ) . toHaveBeenCalledTimes ( 3 ) ; 
159+     expect ( scopeSetTransactionNameSpy ) . toHaveBeenLastCalledWith ( 'testRoute/:id' ) ; 
160+   } ) ; 
161+ 
141162  it ( "doesn't start a navigation span when `instrumentNavigation` is false" ,  ( )  =>  { 
142163    const  integration  =  browserTracingIntegration ( { 
143164      instrumentNavigation : false , 
@@ -185,7 +206,6 @@ describe('browserTracingIntegration', () => {
185206      } , 
186207    } ) ; 
187208
188-     // eslint-disable-next-line deprecation/deprecation 
189209    expect ( startInactiveSpanSpy ) . toHaveBeenCalledWith ( { 
190210      op : 'ui.sveltekit.routing' , 
191211      name : 'SvelteKit Route Change' , 
@@ -248,7 +268,6 @@ describe('browserTracingIntegration', () => {
248268        } , 
249269      } ) ; 
250270
251-       // eslint-disable-next-line deprecation/deprecation 
252271      expect ( startInactiveSpanSpy ) . toHaveBeenCalledWith ( { 
253272        op : 'ui.sveltekit.routing' , 
254273        name : 'SvelteKit Route Change' , 
0 commit comments