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

export default defineConfig({
  plugins: [react()],
  test: {
    environment: "jsdom",
    setupFiles: ["./src/test/setup.ts"],
    globals: true,
    css: false,
    // Web component/unit tests live under src/. The api-client package has no
    // test runner of its own, so its unit tests are picked up here too (they
    // use relative imports and need no DOM-specific setup).
    include: [
      "src/**/*.{test,spec}.{ts,tsx}",
      "../packages/api-client/src/**/*.{test,spec}.{ts,tsx}",
    ],
    exclude: ["node_modules", "dist", ".next", "e2e/**"],
  },
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },
});
