import { defineConfig } from "vitest/config"; import path from "node:path"; import { fileURLToPath } from "node:url"; export default defineConfig({ resolve: { alias: { "@": path.resolve(__dirname, "./src") }, }, test: { projects: [ { resolve: { alias: { "@": path.resolve(__dirname, "./src") } }, 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": fileURLToPath( new URL("./src/lib/server-only-stub.ts", import.meta.url) ), }, conditions: ["react-server", "node", "import", "default"], }, test: { name: "integration", environment: "node", include: ["tests/integration/**/*.test.ts"], hookTimeout: 30_000, testTimeout: 30_000, poolOptions: { forks: { singleFork: true } }, }, }, ], }, });