import { expect } from 'vitest'; import * as matchers from '@testing-library/jest-dom/matchers'; // Explicitly extend vitest's expect with jest-dom matchers. // Using the explicit extend approach (not @testing-library/jest-dom/vitest) for // compatibility with vitest@4.x (the /vitest barrel doesn't extend the same // expect instance in vitest 4's module resolution). expect.extend(matchers); // Type augmentation for the custom matchers (adds toBeInTheDocument, etc.) // This import only carries type declarations — no runtime effect. import '@testing-library/jest-dom/vitest'; // Polyfill ResizeObserver for jsdom (needed by react-grid-layout) if (typeof globalThis.ResizeObserver === 'undefined') { globalThis.ResizeObserver = class ResizeObserver { private callback: ResizeObserverCallback; constructor(callback: ResizeObserverCallback) { this.callback = callback; } observe() { // Fire callback immediately with a mock entry this.callback( [{ contentRect: { width: 1200, height: 800 } } as unknown as ResizeObserverEntry], this, ); } unobserve() {} disconnect() {} }; }