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

// Vitest harness config (kept separate from vite.config.ts).
// The `@` alias mirrors tsconfig.app.json (`"@/*": ["./src/*"]`).
// test.include scopes Vitest to src/** component tests only; it must NOT claim
// the frontend/tests/*.mjs node:test suites (run those via `npm run test:node`).
export default defineConfig({
	plugins: [react()],
	resolve: {
		alias: {
			"@": path.resolve(__dirname, "./src"),
		},
	},
	test: {
		environment: "jsdom",
		globals: true,
		setupFiles: ["./src/test/setup.ts"],
		include: ["src/**/*.{test,spec}.{ts,tsx}"],
	},
});
