Ctrl K
ComunidadGuías…

vitest.config.ts

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
import { defineConfig } from "vitest/config";
import path from "path";

export default defineConfig({
  test: {
    environment: "node",
    // e2e/ holds Playwright specs that need the whole stack running (the
    // E2E workflow); they are not Vitest's to pick up.
    include: ["test/**/*.test.{ts,tsx}"],
    // Runs before anything imports the Prisma client, which reads
    // DATABASE_URL at construction. Redirects the database-backed suites to a
    // scratch database and refuses to run against the development one.
    setupFiles: ["./test/setup.ts"],
    // Test files that hit the live Postgres DB (test/lib/owner.test.ts,
    // test/lib/merchant.test.ts, ...) share tables and each clear them in
    // beforeEach/afterAll. Running test files in parallel workers races
    // those against each other (FK violations, "Owner already exists").
    // Run files sequentially in one process instead.
    fileParallelism: false,
    // next-auth imports "next/server" without an extension, which Next 16's
    // package.json (no "exports" map) doesn't resolve under plain Node ESM.
    // Vite's own resolver handles it fine, so force these deps through Vite
    // transform instead of native Node module resolution.
    server: {
      deps: {
        inline: ["next-auth", "next"],
      },
    },
  },
  resolve: {
    alias: { "@": path.resolve(__dirname, "./src") },
  },
});