-
Notifications
You must be signed in to change notification settings - Fork 724
docs: update Vitest instructions for jest-dom #1229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add instructions on how to configure Vitest to import @testing-library/jest-dom automatically, to match the Vite instructions at 6.2.
✅ Deploy Preview for testing-library ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
@@ -66,6 +66,26 @@ with any testing framework and runner you're comfortable with. | |||
```js | |||
import '@testing-library/jest-dom'; | |||
``` | |||
|
|||
To have Vitest import this automatically in _every_ test file, add the import statement to a new file, then add the file to the `setupFiles` array in the `vitest.config.ts` (in this case, the file is `vitest.include.jsdom.ts` in the project root) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this addition to the docs.
What do you think of adding this under a 5.3 bullet point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's a good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would you use a library specifically for Jest in Vitest? We already have an assertion library specifically for Vitest called vitest-dom
. Could we clarify first if the folks at @testing-library/jest-dom
want to support Vitest in addition to Jest?
I was just updating the current documentation, which uses jest-dom. I didn't even know about
|
Since |
Add instructions on how to configure Vitest to import @testing-library/jest-dom automatically, to match the Vite instructions at 6.2.