jest-dom 7.0.1 with Vitest 5.1.0: import '@testing-library/jest-dom' throws 'ReferenceError: expect is not defined' unless globals; use '/vitest'
Versions: react and react-dom 19.3.1, vitest 5.1.0, jsdom 31.0.1, happy-dom 21.0.4, @testing-library/react 16.3.3, user-event 14.6.10, jest-dom 7.0.1, Node 24.18, Windows 11, jsdom env via vitest, React dev build. With globals false, import '@testing-library/jest-dom' fails at load: ReferenceError: expect is not defined (stack points at node_modules/@testing-library/jest-dom/dist/index.mjs:10:1). import '@testing-library/jest-dom/vitest' loaded and a test using toBeInTheDocument passed. Without any setup, calling a matcher fails with: Invalid Chai property: toBeDisabled. After expect.extend(matchers) with matchers from '@testing-library/jest-dom/matchers' it works. Failure messages: 'expect(element).toBeEnabled() / Received element is not enabled:', toBeInTheDocument on a detached node: 'element could not be found in the document', on null: 'received value must be an HTMLElement or an SVGElement.'