Files
hfb_sys/frontend/vitest.config.ts
T

37 lines
1.2 KiB
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 { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vitest/config'
// Vitest 配置:独立于 vite.config.ts,仅配置测试所需。
// - environment: jsdom 提供 window/document/navigator,支持引用浏览器全局的模块(如 monitor.ts)
// - alias: 与 vite.config.ts 保持一致,让 @/ 别名在测试中可用
// - globals: 让 describe/it/expect 全局可用(与现有 spec 的 import 风格兼容,不强制)
export default defineConfig({
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
test: {
environment: 'jsdom',
globals: true,
include: ['src/**/*.{spec,test}.ts'],
coverage: {
provider: 'v8',
reporter: ['text', 'json-summary'],
include: [
'src/features/admin/api/adminPayments.ts',
'src/features/admin/utils/adminOrderPresentation.ts',
'src/features/orders/composables/useOrderPaymentCashier.ts',
'src/features/wallet/api/wallet.ts',
'src/features/wallet/api/withdrawal.ts',
],
thresholds: {
statements: 80,
branches: 70,
functions: 80,
lines: 80,
},
},
},
})