import type { TestingLibraryMatchers } from '@testing-library/jest-dom/matchers'; import matchers from '@testing-library/jest-dom/matchers'; import { cleanup } from '@testing-library/react'; import { afterEach, expect } from 'vitest'; // Workaround for TypeScript error: https://github.com/testing-library/jest-dom/issues/439#issuecomment-1536524120 declare module 'vitest' { interface Assertion extends jest.Matchers, TestingLibraryMatchers {} } // Extends Vitest's expect method with methods from react-testing-library expect.extend(matchers); // Clear all mocks and cleanup DOM after every test afterEach(() => { vi.clearAllMocks(); cleanup(); }); (global as any).scrollTo = () => {};