Skip to content
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

DT types for jest-dom should not be used #9711

Merged
merged 1 commit into from
Dec 14, 2023

Conversation

Tobbe
Copy link
Member

@Tobbe Tobbe commented Dec 14, 2023

With the update to @testing-library/jest-dom v6 in #9673 types are built-in, and so https://www.npmjs.com/package/@types/testing-library__jest-dom should not be used anymore

Marking this as breaking since it requires #9673 which is breaking

@Tobbe Tobbe added the release:chore This PR is a chore (means nothing for users) label Dec 14, 2023
@Tobbe Tobbe added this to the v7.0.0 milestone Dec 14, 2023
@Tobbe Tobbe added release:breaking This PR is a breaking change and removed release:chore This PR is a chore (means nothing for users) labels Dec 14, 2023
@Tobbe Tobbe merged commit 375453a into redwoodjs:main Dec 14, 2023
30 of 42 checks passed
@Tobbe Tobbe deleted the tobbe-jest-dom-dt branch December 14, 2023 13:27
jtoar added a commit that referenced this pull request Dec 15, 2023
jtoar added a commit that referenced this pull request 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.
Tobbe added a commit that referenced this pull request Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:breaking This PR is a breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant