import '@testing-library/jest-dom/vitest'; import { afterEach, vi } from 'vitest'; import { cleanup } from '@testing-library/react'; afterEach(() => { cleanup(); // Globals stubbed with vi.stubGlobal must be dropped between tests, // otherwise a stub from one test leaks into the next one. vi.unstubAllGlobals(); vi.restoreAllMocks(); window.localStorage.clear(); });