import { defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react";
import path from "path";

export default defineConfig({
  plugins: [react()],
  test: {
    environment: "node",
    globals: true,
    setupFiles: ["./vitest.setup.ts"],
    coverage: {
      provider: "v8",
      reporter: ["text", "lcov", "html"],
      include: ["lib/**/*.ts"],
      exclude: [
        "lib/auth/**",
        "lib/i18n/**",
        "lib/ai/features/**",
        "lib/openapi.ts",
        "lib/push.ts",
        "lib/redis.ts",
        "lib/storage.ts",
        "lib/utils.ts",
        "lib/email.ts",
        "**/*.d.ts",
        "**/__tests__/**",
      ],
      thresholds: {
        lines: 60,
        functions: 60,
        branches: 55,
        statements: 60,
      },
    },
  },
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "."),
      "@epicure/db": path.resolve(__dirname, "../../packages/db/src/index.ts"),
    },
  },
});
