@testing-library/jest-dom version: 6.4.8
node version: 20.14.0
vitest version: 2.0.4
pnpm version: 9.4.0
@testing-library/react version: 16.0.0
Relevant code or config:
describe('ellipseAddressJsx', () => {
it('should return ellipsed address with specified width', () => {
const address = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
const width = 4
const { container } = render(ellipseAddressJsx(address, width))
expect(container).toHaveTextContent('aaaa…aaaa')
})
})
What you did:
Upgraded from vitest 2.0.3 from 2.0.4
What happened:
After upgrading to vitest@2.0.4 this TypeScript error appeared in every @testing-library/jest-dom assertion:

Reproduction:
https://codesandbox.io/p/devbox/silly-panna-vx86jv
See src/utils.test.tsx
Problem description:
Following the instructions for using @testing-library/jest-dom with Vitest provided here no longer seems to work in the latest version of Vitest. (Confirmed this is also the case for vitest@2.0.5)
Suggested solution:
As suggested here: #546 (comment)
In tsconfig.json:
{
"compilerOptions": {
"types": ["@testing-library/jest-dom"]
},
}
This resolves the issue.
@testing-library/jest-domversion: 6.4.8nodeversion: 20.14.0vitestversion: 2.0.4pnpmversion: 9.4.0@testing-library/reactversion: 16.0.0Relevant code or config:
What you did:
Upgraded from
vitest2.0.3 from 2.0.4What happened:
After upgrading to

vitest@2.0.4this TypeScript error appeared in every@testing-library/jest-domassertion:Reproduction:
https://codesandbox.io/p/devbox/silly-panna-vx86jv
See src/utils.test.tsx
Problem description:
Following the instructions for using
@testing-library/jest-domwith Vitest provided here no longer seems to work in the latest version of Vitest. (Confirmed this is also the case forvitest@2.0.5)Suggested solution:
As suggested here: #546 (comment)
In tsconfig.json:
{ "compilerOptions": { "types": ["@testing-library/jest-dom"] }, }This resolves the issue.