Files
no-whatever/vitest.config.ts

57 lines
1.3 KiB
TypeScript

import { defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react";
import path from "path";
const shared = {
globals: true,
setupFiles: ["src/__tests__/helpers/setup.ts"],
env: {
AMAP_API_KEY: "test-amap-key",
DEEPSEEK_API_KEY: "test-deepseek-key",
JWT_SECRET: "test-jwt-secret",
},
} as const;
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
},
},
test: {
coverage: {
provider: "v8",
reporter: ["text", "html"],
thresholds: {
statements: 57,
branches: 50,
functions: 47,
lines: 60,
},
},
projects: [
{
plugins: [react()],
resolve: { alias: { "@": path.resolve(__dirname, "src") } },
test: {
...shared,
name: "ui",
environment: "jsdom",
include: ["src/**/*.test.{ts,tsx}"],
exclude: ["src/app/api/**", "src/lib/**/*.test.ts"],
},
},
{
resolve: { alias: { "@": path.resolve(__dirname, "src") } },
test: {
...shared,
name: "api",
environment: "node",
include: ["src/app/api/**/*.test.ts", "src/lib/**/*.test.ts"],
},
},
],
},
});