diff --git a/frontend/src/tests/setup.ts b/frontend/src/tests/setup.tsx similarity index 78% rename from frontend/src/tests/setup.ts rename to frontend/src/tests/setup.tsx index 8054df7ac..040ec6a84 100644 --- a/frontend/src/tests/setup.ts +++ b/frontend/src/tests/setup.tsx @@ -2,10 +2,21 @@ import { http } from "msw"; import { HttpResponse } from "msw"; -import { vitest } from "vitest"; +import { vi, vitest } from "vitest"; import "@testing-library/jest-dom"; import server from "./mocks/node"; +vi.mock("recharts", async () => { + const OriginalRechartsModule = await vi.importActual("recharts"); + + return { + ...OriginalRechartsModule, + ResponsiveContainer: ({ children }: { children: React.ReactNode }) => ( +
{children}
+ ), + }; +}); + // From https://stackoverflow.com/questions/39830580/jest-test-fails-typeerror-window-matchmedia-is-not-a-function Object.defineProperty(window, "matchMedia", { writable: true, diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index fbae83c88..3eecb807d 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -132,7 +132,7 @@ export default defineConfig(async ({ mode, command }) => { test: { globals: true, environment: "jsdom", - setupFiles: "./src/tests/setup.ts", + setupFiles: "./src/tests/setup.tsx", }, server: { proxy: {