Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,25 @@ if (typeof globalThis.localStorage === "undefined") {
|
||||
});
|
||||
}
|
||||
|
||||
// jsdom does not implement matchMedia. useMediaQuery (used by the shell
|
||||
// sidebar) calls it on mount, so provide a minimal non-matching stub.
|
||||
if (typeof window !== "undefined" && typeof window.matchMedia !== "function") {
|
||||
Object.defineProperty(window, "matchMedia", {
|
||||
value: (query: string): MediaQueryList =>
|
||||
({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addEventListener: () => {},
|
||||
removeEventListener: () => {},
|
||||
addListener: () => {},
|
||||
removeListener: () => {},
|
||||
dispatchEvent: () => false,
|
||||
}) as MediaQueryList,
|
||||
writable: true,
|
||||
});
|
||||
}
|
||||
|
||||
// Start MSW at module level so its fetch patch is in place before any test
|
||||
// module captures globalThis.fetch via openapi-fetch's createClient().
|
||||
server.listen({ onUnhandledRequest: "error" });
|
||||
|
||||
Reference in New Issue
Block a user