fix(test): 🔨修复 vitest 单元测试运行报错等问题
- 在 tests/setup.ts 中添加 __APP_INFO__ 全局 mock - 在 vitest.config.ts 中配置 AutoImport 插件以支持 Vue API 自动导入
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user