Skip to content

Commit 9502ab3

Browse files
fix: Handle window.location redefinition errors in tests
Use Reflect.deleteProperty to properly remove location property before redefining it
1 parent df39a2a commit 9502ab3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

client/src/utils/__tests__/configUtils.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import { InspectorConfig } from "../../lib/configurationTypes";
1010

1111
// Helper to mock window.location
1212
function mockWindowLocation(href: string) {
13+
// Delete the property first if it exists and is configurable
14+
Reflect.deleteProperty(window, "location");
15+
1316
Object.defineProperty(window, "location", {
1417
value: { ...window.location, href },
1518
writable: true,

0 commit comments

Comments
 (0)