/** * Vitest 测试环境设置 */ import { beforeAll, afterAll, vi } from 'vitest'; // Mock console.warn/error 避免测试输出干扰 beforeAll(() => { vi.spyOn(console, 'warn').mockImplementation(() => {}); }); afterAll(() => { vi.restoreAllMocks(); }); // 设置测试环境变量 process.env.NODE_ENV = 'test';