@@ -26,6 +26,7 @@ import {
2626} from 'react-router-6' ;
2727import { beforeEach , describe , expect , it , vi } from 'vitest' ;
2828import { BrowserClient } from '../src' ;
29+ import { allRoutes } from '../src/reactrouter-compat-utils/instrumentation' ;
2930import {
3031 reactRouterV6BrowserTracingIntegration ,
3132 withSentryReactRouterV6Routing ,
@@ -101,6 +102,7 @@ describe('React Router cross usage of wrappers', () => {
101102 beforeEach ( ( ) => {
102103 vi . clearAllMocks ( ) ;
103104 getCurrentScope ( ) . setClient ( undefined ) ;
105+ allRoutes . clear ( ) ;
104106 } ) ;
105107
106108 describe ( 'wrapCreateBrowserRouter and wrapUseRoutes' , ( ) => {
@@ -218,8 +220,7 @@ describe('React Router cross usage of wrappers', () => {
218220
219221 expect ( container . innerHTML ) . toContain ( 'Details' ) ;
220222
221- // It's called 1 time from the wrapped `MemoryRouter`
222- expect ( mockStartBrowserTracingNavigationSpan ) . toHaveBeenCalledTimes ( 1 ) ;
223+ expect ( mockStartBrowserTracingNavigationSpan ) . toHaveBeenCalledTimes ( 2 ) ;
223224 expect ( mockStartBrowserTracingNavigationSpan ) . toHaveBeenLastCalledWith ( expect . any ( BrowserClient ) , {
224225 name : '/second-level/:id/third-level/:id' ,
225226 attributes : {
@@ -339,7 +340,6 @@ describe('React Router cross usage of wrappers', () => {
339340
340341 expect ( container . innerHTML ) . toContain ( 'Details' ) ;
341342
342- // It's called 1 time from the wrapped `MemoryRouter`
343343 expect ( mockStartBrowserTracingNavigationSpan ) . toHaveBeenCalledTimes ( 1 ) ;
344344 } ) ;
345345 } ) ;
@@ -465,8 +465,7 @@ describe('React Router cross usage of wrappers', () => {
465465
466466 expect ( container . innerHTML ) . toContain ( 'Details' ) ;
467467
468- // It's called 1 time from the wrapped `createMemoryRouter`
469- expect ( mockStartBrowserTracingNavigationSpan ) . toHaveBeenCalledTimes ( 1 ) ;
468+ expect ( mockStartBrowserTracingNavigationSpan ) . toHaveBeenCalledTimes ( 2 ) ;
470469
471470 expect ( mockStartBrowserTracingNavigationSpan ) . toHaveBeenLastCalledWith ( expect . any ( BrowserClient ) , {
472471 name : '/second-level/:id/third-level/:id' ,
@@ -596,7 +595,7 @@ describe('React Router cross usage of wrappers', () => {
596595 ) ;
597596
598597 expect ( container . innerHTML ) . toContain ( 'Details' ) ;
599- expect ( mockStartBrowserTracingNavigationSpan ) . toHaveBeenCalledTimes ( 1 ) ;
598+ expect ( mockStartBrowserTracingNavigationSpan ) . toHaveBeenCalledTimes ( 2 ) ;
600599 expect ( mockStartBrowserTracingNavigationSpan ) . toHaveBeenLastCalledWith ( expect . any ( BrowserClient ) , {
601600 name : '/second-level/:id/third-level/:id' ,
602601 attributes : {
0 commit comments