Skip to content

Revert @testing-library/jest-dom v6 upgrade #9713

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

Merged
merged 2 commits into from
Dec 15, 2023

Conversation

jtoar
Copy link
Contributor

@jtoar jtoar commented Dec 15, 2023

This reverts #9673 and #9711.

With v6 of @testing-library/jest-dom, yarn rw type-check fails in Redwood projects because it can't locate the types for @testing-libary/jest-dom. They absorbed the definitely types package (@types/testing-library__jest-dom) in this PR: testing-library/jest-dom#511. Here's an example of a failing run: https://github.com/redwoodjs/redwood/actions/runs/7213177056/job/19668365614?pr=9708.

The logical thing to do is remove @testing-libary/jest-dom from the types array in web/tsconfig.json, but when we do that we get a different failure from TS saying that it doesn't understand the extended matchers provided by testing-library/jest-dom like toBeInTheDocument.

@Tobbe filed an issue in their repo here testing-library/jest-dom#559.

In the PR I linked to, the maintainer notes that...

But in my local testing with the changes in this PR, following the Readme was sufficient to get full auto-complete support even for JS-only users. As long as they have a jest-setup file that imports the bare export and add a dependency on @types/jest, recent versions of VS Code will figure it out.

Users don't have jest setup files in their project (we just point to a jest preset) or @types/jest as an explicit dev dependency.

I took a look at it but couldn't crack it today. Instead of holding up other PRs in CI, better to revert it for now and come back to later when we have more leads.

@jtoar jtoar changed the title Revert @testing-library/jest-dom v6 upgrade Revert @testing-library/jest-dom v6 upgrade Dec 15, 2023
@jtoar jtoar added the release:chore This PR is a chore (means nothing for users) label Dec 15, 2023
@jtoar jtoar added this to the v7.0.0 milestone Dec 15, 2023
@jtoar jtoar merged commit 0d1e09a into main Dec 15, 2023
@jtoar jtoar deleted the ds-v7/revert-testing-library-major branch December 15, 2023 08:08
Tobbe added a commit to Tobbe/redwood that referenced this pull request Dec 15, 2023
Tobbe added a commit to Tobbe/redwood that referenced this pull request Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:chore This PR is a chore (means nothing for users)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant