// vitest 全局测试基建:注册 jest-dom 断言匹配器 + 每个用例后自动卸载组件树。 // 在 vitest.config.ts 的 test.setupFiles 里登记,所有 *.test.tsx 共享。 import '@testing-library/jest-dom/vitest'; import { afterEach } from 'vitest'; import { cleanup } from '@testing-library/react'; afterEach(() => { cleanup(); });