kanban-dev-webapp/vitest.config.ts
Dave 14f6c067c2 test(plan): integration test for the new Gantt view
Two tests against the live database and the seeded project:

- loadPlan returns a section containing the seeded project.
- GanttPlanView renders the project name and at least one
  card title to HTML.

vitest integration config now picks up .test.tsx too.
2026-09-21 16:19:52 +02:00

53 lines
1.6 KiB
TypeScript

import { defineConfig } from "vitest/config";
import path from "node:path";
import { fileURLToPath } from "node:url";
const serverOnlyStub = fileURLToPath(
new URL("./src/lib/server-only-stub.ts", import.meta.url)
);
export default defineConfig({
resolve: {
alias: { "@": path.resolve(__dirname, "./src") },
},
test: {
projects: [
{
// Unit tests can also import server-only modules (e.g.
// writeCardWithAudit) and replace the guard with the empty stub,
// matching the integration project's alias.
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
"server-only": serverOnlyStub,
},
},
test: {
name: "unit",
environment: "node",
include: ["src/**/*.test.ts"],
},
},
{
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
// Replace server-only with the empty stub so integration tests
// can import server modules without "imported from a Client
// Component module" blowing up at prepare time.
"server-only": serverOnlyStub,
},
conditions: ["react-server", "node", "import", "default"],
},
test: {
name: "integration",
environment: "node",
include: ["tests/integration/**/*.test.ts", "tests/integration/**/*.test.tsx"],
hookTimeout: 30_000,
testTimeout: 30_000,
poolOptions: { forks: { singleFork: true } },
},
},
],
},
});