import { fileURLToPath, URL } from 'node:url' import { defineConfig } from 'vitest/config' import vue from '@vitejs/plugin-vue' export default defineConfig({ plugins: [vue()], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)), }, }, test: { environment: 'jsdom', globals: true, setupFiles: ['./tests/setup.js'], css: false, coverage: { provider: 'v8', reporter: ['text', 'html'], // 只统计源码,排除入口、主题预设等纯常量文件 include: ['src/**/*.{js,vue}'], exclude: ['src/main.js', 'src/theme/presets.js'], // 60% 起步门槛:AI 全权测试时用 pnpm test:coverage 检查缺口; // 普通 pnpm test 不应用阈值(vitest 仅在 --coverage 下检查 thresholds) thresholds: { lines: 60, functions: 60, branches: 60, statements: 60, }, }, }, })