-
Notifications
You must be signed in to change notification settings - Fork 400
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
5.11.10 broke toBeVisible and toBeInTheDocument #354
Comments
Hi. I'm sorry this upgrade broke things for you. Unfortunately, we do not have much here in terms of where to look. The release you pointed out only touched code related to the Can you reliably have the problem fixed if you downgrade to v5.11.9? The answer to this question is to further confirm that this release is to blame. |
Yeah, our latest master branch uses 5.11.9, all tests pass - 0 warnings and 0 errors. I've tried to make reproducible example yesterday but it seems that with simple setup it works fine, I will try to mimic the exact test that fails in our repo. It might be related to nested dom elements or something. Not sure if I have time today for this, but at least will try to do so on weekend. |
I have the same issue for some specs as well. It seems to be related to self closing tags, a bugfix introduced in version 5.11.10 For example:
It seems like the classes are gone as well and the tag is self closed, because the error messages looks like:
But actually the element has the class
|
An example where we can reproduce this will go a long way in being able to solve it. As it stands now, I am not even sure where to start, as this has not posed a problem in general (as acknowledged by Artem above when trying to reproduce it in an isolated manner). |
I have the same issue. Running some unit tests of a Vue 2 project with vue-test-utils and jest-dom. Everything is fine when running the unit tests with version 5.11.9 but all tests using @drdent describes the problem very well. It seems to have something to do with self closing HTML tags. |
Actually I found a solution: You have to attach the component to the DOM, like: @ArtemKolichenkov @phaust You can give it a try. |
Yeah, that solution works for me. Thx @drdent for providing it. |
I have upgraded from 5.11.0 to 5.12.0. All tests with
Solution from @drdent fixed all cases |
@ArtemKolichenkov can we close this issue? |
Thanks for the feedback everyone. I'm closing this for now. |
For users of vue-test-utils who find this issue, there is also an alternative expect(wrapper.find('nav').isVisible()).toBe(true); |
hi @gnapse , I face this issue too when try to upgrade jest-dom to the latest version. It worked on 5.11.9. |
@albuseh an example where we can reproduce this will go a long way in being able to help you solve it. |
@drdent, thank you so much for posting this! 🙏 I had the same problem as others in this thread, adding |
@testing-library/jest-dom
version: 5.11.10node
version: 14.15.4npm
(oryarn
) version: 6.14.10react-testing-library
version: 11.2.5 (but behaves the same with newer 11.2.6Relevant code or config:
What you did:
Upgraded @testing-library/jest-dom from
5.11.9
to5.11.10
What happened:
Reproduction:
Unfortunately I can't share company code. The code block above is roughly the context when it happens. I've tried to make minimal example on codesandbox but in simplest example it actually works just fine, I need to figure out what exactly causing the issue. If I'll have time for this later this week I'll update this issue, now unfortunately can't spend hours finding root cause, I just know that the only reason why it fails is upgrade
Problem description:
After upgrading @testing-library/jest-dom from
5.11.9
to5.11.10
.toBeVisible()
throws withReceived element is not visible (element is not in the document)
even though RTL'sdebug()
shows the element just fine. And tests were passing without any warnings or errors just one patch version before in5.11.9
. Similar behaviour withtoBeInTheDocument()
Suggested solution:
According to changelog - this PR is the only change. Not really sure why and how though.
The text was updated successfully, but these errors were encountered: