Skip to content

Commit 682d8a3

Browse files
committed
tests: update tests
1 parent aa64e2d commit 682d8a3

File tree

8 files changed

+12
-8
lines changed

8 files changed

+12
-8
lines changed

packages/nextjs/src/client/routing/isrRoutingTracing.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { RouteManifest } from '../../config/manifest/types';
22
import { maybeParameterizeRoute } from './parameterization';
3-
import { GLOBAL_OBJ } from '@sentry/core';
3+
import { WINDOW } from '@sentry/react';
44

5-
const globalWithInjectedValues = GLOBAL_OBJ as typeof GLOBAL_OBJ & {
5+
const globalWithInjectedValues = WINDOW as typeof WINDOW & {
66
_sentryRouteManifest: string | RouteManifest;
77
};
88

@@ -41,14 +41,14 @@ function isIsrSsgRoute(pathname: string): boolean {
4141
* This prevents the browser tracing integration from using stale/cached trace IDs.
4242
*/
4343
export function removeIsrSsgTraceMetaTags(): void {
44-
if (typeof document === 'undefined') {
44+
if (!WINDOW.document || !isIsrSsgRoute(WINDOW.location.pathname)) {
4545
return;
4646
}
4747

4848
// Helper function to remove a meta tag
4949
const removeMetaTag = (metaName: string) => {
5050
try {
51-
const meta = document.querySelector(`meta[name="${metaName}"]`);
51+
const meta = WINDOW.document.querySelector(`meta[name="${metaName}"]`);
5252
if (meta) {
5353
meta.remove();
5454
}
@@ -57,10 +57,6 @@ export function removeIsrSsgTraceMetaTags(): void {
5757
}
5858
};
5959

60-
if (!isIsrSsgRoute(window.location.pathname)) {
61-
return;
62-
}
63-
6460
// Remove the meta tags so browserTracingIntegration won't pick them up
6561
removeMetaTag('sentry-trace');
6662
removeMetaTag('baggage');

packages/nextjs/test/config/manifest/suites/base-path/base-path.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ describe('basePath', () => {
1919
hasOptionalPrefix: false,
2020
},
2121
],
22+
isrRoutes: [],
2223
});
2324
});
2425

packages/nextjs/test/config/manifest/suites/catchall-at-root/catchall-at-root.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ describe('catchall', () => {
1616
hasOptionalPrefix: false,
1717
},
1818
],
19+
isrRoutes: [],
1920
});
2021
});
2122

packages/nextjs/test/config/manifest/suites/catchall/catchall.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ describe('catchall', () => {
1616
hasOptionalPrefix: false,
1717
},
1818
],
19+
isrRoutes: [],
1920
});
2021
});
2122

packages/nextjs/test/config/manifest/suites/dynamic/dynamic.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ describe('dynamic', () => {
3434
hasOptionalPrefix: false,
3535
},
3636
],
37+
isrRoutes: [],
3738
});
3839
});
3940

packages/nextjs/test/config/manifest/suites/file-extensions/file-extensions.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ describe('file-extensions', () => {
1616
{ path: '/typescript' },
1717
],
1818
dynamicRoutes: [],
19+
isrRoutes: [],
1920
});
2021
});
2122
});

packages/nextjs/test/config/manifest/suites/route-groups/route-groups.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ describe('route-groups', () => {
2626
hasOptionalPrefix: false,
2727
},
2828
],
29+
isrRoutes: [],
2930
});
3031
});
3132

@@ -59,6 +60,7 @@ describe('route-groups', () => {
5960
hasOptionalPrefix: false,
6061
},
6162
],
63+
isrRoutes: [],
6264
});
6365
});
6466

packages/nextjs/test/config/manifest/suites/static/static.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ describe('static', () => {
88
expect(manifest).toEqual({
99
staticRoutes: [{ path: '/' }, { path: '/some/nested' }, { path: '/user' }, { path: '/users' }],
1010
dynamicRoutes: [],
11+
isrRoutes: [],
1112
});
1213
});
1314
});

0 commit comments

Comments
 (0)