mercury-web/vitest.config.ts

24 lines
965 B
TypeScript

import { fileURLToPath } from "node:url";
import { configDefaults, defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react";
export default defineConfig({
plugins: [react()],
// Mirrors tsconfig's "@/*" -> "./src/*" path mapping (Next resolves this
// natively; Vite/Vitest need it spelled out) so ds/ modules that import
// via "@/..." (e.g. TabBar.tsx -> "@/i18n/common") resolve under Vitest too.
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
test: {
environment: "jsdom",
setupFiles: ["./vitest.setup.ts"],
globals: true,
server: { deps: { inline: [/@seed-design/] } },
// e2e/ holds Playwright specs (own `test()`, own runner) — exclude them
// from Vitest's collection alongside the defaults, or `*.spec.ts` there
// gets picked up by Vitest's default include glob and fails to load.
exclude: [...configDefaults.exclude, "e2e/**"],
},
});