jest-dom
jest-dom copied to clipboard
It looks like the Recent Build has a Breaking Error in it OR that you need to update the usage
I followed the exact instructions as in your readme, and using the latest version of the library,
-
Created a setupTests.ts file, with the single line
import "@testing-library/jest-dom"
-
Made sure this file is referenced in the tsconfig.json, inside of the includes.
"include": ["./setupTests.ts"],
-
Also referenced it in the jest.config.js
setupFilesAfterEnv: ["./setupTests.ts"]
Now when i run tests, they all pass,
but in the test file, I get a typescript error, that the type toBeVisible
does not exist, but if I added a direct import of
@testing-library/jest-dom
then typescript was happy.
THEN
I uninstalled the latest version of @testing-library/jest-dom
and went to Version 5.16.5, from one year back and installed that. I made no other change and found that immediately the toBeVisible
type was no longer throwing an error.
It seems therefore that sometime after Version 5.16.5, a bug has been introduced - OR that you need to update the usage as the old usage instructions are no longer valid.
Version 5.17.0 is fine too, it seems the issue is from Version 6 onwards, possibly the usage instructions need changing, or there is a breaking error.