diff --git a/src/test/setup.ts b/src/test/setup.ts index f8dc53f..23e03cf 100644 --- a/src/test/setup.ts +++ b/src/test/setup.ts @@ -1,10 +1,13 @@ import "@testing-library/jest-dom/vitest"; -import { cleanup } from "@testing-library/react"; +import { cleanup, configure } from "@testing-library/react"; import { afterAll, afterEach, beforeAll } from "vitest"; import { configureAuthClient } from "@/shared/api"; import "../shared/i18n"; import { server } from "./server"; +// Allow async UI updates on the slower CI runner; local waits stay unchanged. +if (process.env.CI) configure({ asyncUtilTimeout: 5_000 }); + beforeAll(() => server.listen({ onUnhandledRequest: "error" })); afterEach(() => { cleanup(); diff --git a/vitest.config.ts b/vitest.config.ts index f5765db..886917c 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -2,10 +2,14 @@ import { fileURLToPath, URL } from "node:url"; import react from "@vitejs/plugin-react"; import { configDefaults, defineConfig } from "vitest/config"; +const CI_TEST_TIMEOUT_MS = 15_000; + export default defineConfig({ plugins: [react()], resolve: { alias: { "@": fileURLToPath(new URL("./src", import.meta.url)) } }, test: { + // CI runs the UI scenarios with coverage on a slower runner. + testTimeout: process.env.CI ? CI_TEST_TIMEOUT_MS : undefined, environment: "jsdom", exclude: configDefaults.exclude, setupFiles: "./src/test/setup.ts",