import '@testing-library/jest-dom/vitest' import { cleanup } from '@testing-library/react' import { afterEach, beforeEach, vi } from 'vitest' // jsdom has no layout observers or element scrolling. beforeEach(() => { if (typeof HTMLElement === 'undefined') return vi.stubGlobal( 'ResizeObserver', class { observe() {} unobserve() {} disconnect() {} }, ) HTMLElement.prototype.scrollIntoView = vi.fn() }) afterEach(() => { cleanup() vi.useRealTimers() vi.restoreAllMocks() vi.unstubAllGlobals() })