-
Notifications
You must be signed in to change notification settings - Fork 335
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
Add Jest test matchers for jsdom #5011
Conversation
📋 StatsFile sizes
Modules
View stats and visualisations on the review app Action run for 182b60e |
482f342
to
e2ca933
Compare
3c8ee59
to
ea3d9fc
Compare
shared/helpers/package.json
Outdated
"@testing-library/jest-dom": "^6.4.5", | ||
"@types/testing-library__jest-dom": "^6.0.0", |
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.
nitpick Given the jest.config.mjs
is at the root of the repository, I think those two should go in the root package.json
. That's also where jest
and its plugins are listed as dependencies. I think things work at the moment because Node hoists packages to the root
node_modules when it installs dependencies from workspaces.
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.
Looking forward to use the new matchers. I think you need to update where the new dependencies have been installed, though 😊
Include the @testing-library/jest-dom library which provides custom Jest matchers for asserting things about the state of the DOM, including things like what class an element has (`toHaveClass`), or the accessible description for an element (`toHaveAccessibleDescription`).
ea3d9fc
to
182b60e
Compare
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.
Neat! And nice find on the ESLint plugin as well ⛵
Add Jest test matchers for jsdom
Include the @testing-library/jest-dom library which provides custom Jest matchers for asserting things about the state of the DOM, including things like what class an element has (
toHaveClass
), or the accessible description for an element (toHaveAccessibleDescription
).This as the first step in migrating our template tests from Cheerio to jsdom.
Part of #5010