bc98606045
- include限定在src/test/**/*.test.ts(x),只跑单元测试 - exclude加e2e/和**/*.spec.ts,避免误跑playwright测试 - coverage exclude同步加e2e/
35 lines
946 B
TypeScript
Executable File
35 lines
946 B
TypeScript
Executable File
/**
|
|
* Vitest 配置文件
|
|
*/
|
|
import { defineConfig } from "vitest/config"
|
|
import react from "@vitejs/plugin-react"
|
|
import path from "path"
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
test: {
|
|
globals: true,
|
|
environment: "jsdom",
|
|
setupFiles: "./src/test/setup.ts",
|
|
include: ["src/test/**/*.test.ts", "src/test/**/*.test.tsx"],
|
|
exclude: ["node_modules/", "e2e/", "**/*.spec.ts", "**/*.spec.tsx"],
|
|
coverage: {
|
|
provider: "v8",
|
|
reporter: ["text", "json", "html"],
|
|
exclude: ["node_modules/", "src/test/", "e2e/", "**/*.d.ts", "**/*.config.*", "**/mockData"],
|
|
// CI 覆盖率门禁(极低门槛起步,逐步提升)
|
|
// 当前覆盖率约 0.8%/0.9%/1.1%,先设极低门槛确保CI跑通
|
|
thresholds: {
|
|
lines: 0.5,
|
|
functions: 0.5,
|
|
branches: 0.5,
|
|
},
|
|
},
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "./src"),
|
|
},
|
|
},
|
|
})
|