fix(test): 🔨修复 vitest 单元测试运行报错等问题

- 在 tests/setup.ts 中添加 __APP_INFO__ 全局 mock
- 在 vitest.config.ts 中配置 AutoImport 插件以支持 Vue API 自动导入
This commit is contained in:
XFeng
2026-01-13 19:45:34 +08:00
parent cc8560a048
commit f41df4a811
2 changed files with 25 additions and 1 deletions

View File

@@ -41,6 +41,14 @@ global.ResizeObserver = class ResizeObserver {
// Mock Element.scrollIntoView
Element.prototype.scrollIntoView = vi.fn();
// Mock __APP_INFO__
(globalThis as any).__APP_INFO__ = {
pkg: {
name: "vue3-element-admin",
version: "4.0.0",
},
};
// Mock console methods to reduce noise in tests
global.console = {
...console,