vitest.config.ts
Rama main · réplica de lectura del repositorio original.
import { fileURLToPath } from "node:url";
import { defineConfig } from "vitest/config";
export default defineConfig({
// The web app's `@/` import alias, so its route handlers can be tested as they are written.
resolve: {
alias: [
{ find: /^@\//, replacement: fileURLToPath(new URL("./apps/web/src/", import.meta.url)) },
],
},
// The web tsconfig uses `jsx: preserve` because Next compiles the JSX itself; vitest does not
// go through Next, so it needs the automatic runtime spelled out here.
esbuild: { jsx: "automatic" },
test: {
// .tsx too: React components carry behaviour worth testing (secret-inputs toggles `type`
// on a focused field, which is exactly the sort of thing that breaks silently).
include: ["packages/**/*.test.ts", "apps/**/*.test.{ts,tsx}"],
environment: "node",
globalSetup: ["./vitest.globalSetup.ts"],
// DB integration tests share one Postgres; run files serially so they don't clobber each
// other's rows. The suite is small, so the cost is negligible.
fileParallelism: false,
coverage: {
provider: "v8",
include: ["packages/*/src/**", "apps/*/src/**"],
},
},
});