37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
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,
|
||
},
|
||
},
|
||
},
|
||
})
|