Files
vue3-element-admin/vitest.config.ts
2025-12-26 12:35:37 +08:00

44 lines
928 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { defineConfig } from "vitest/config";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";
export default defineConfig({
plugins: [vue()],
test: {
// 使用 happy-dom 作为测试环境(比 jsdom 快)
environment: "happy-dom",
// 全局测试 APIdescribe, it, expect 等)
globals: true,
// 测试环境设置文件
setupFiles: ["./tests/setup.ts"],
// 覆盖率配置
coverage: {
provider: "v8",
reporter: ["text", "json", "html"],
exclude: [
"node_modules/",
"tests/",
"**/*.d.ts",
"**/*.config.*",
"**/mockData",
"**/.{idea,git,cache,output,temp}",
],
},
// 测试文件匹配规则
include: ["tests/**/*.{test,spec}.{js,ts}"],
// 测试超时时间
testTimeout: 10000,
},
resolve: {
alias: {
"@": resolve(__dirname, "./src"),
},
},
});