17 lines
471 B
TypeScript
17 lines
471 B
TypeScript
import { defineConfig } from 'vitest/config'
|
||
import vue from '@vitejs/plugin-vue'
|
||
import { resolve } from 'path'
|
||
|
||
export default defineConfig({
|
||
plugins: [vue()],
|
||
test: {
|
||
// 关键:模拟浏览器环境,否则无法测试 DOM 和滚动
|
||
environment: 'happy-dom',
|
||
// 支持全局 API 如 describe, it, expect
|
||
globals: true,
|
||
// 路径别名(确保能找到你的 @/components)
|
||
alias: {
|
||
'@': resolve(__dirname, './src')
|
||
}
|
||
},
|
||
}) |