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

TypeError: element.getRootNode is not a function when using toBeVisible or toBeInTheDocument #458

Open
milkshakeuk opened this issue May 18, 2022 · 0 comments

Comments

@milkshakeuk
Copy link

milkshakeuk commented May 18, 2022

  • @testing-library/jest-dom version: any version since 5.11.10
  • node version: 16.15.0
  • npm version: 7.2.0
  • aurelia-testing version: 1.1.0

Relevant code or config:

We are using the default jest testEnvironment of node.

...
const readOnlyTitle = component.querySelector("[data-spec=rtr-read-only-title]")
expect(readOnlyTitle).toBeVisible();

What you did:

upgrading jest-dom dependency from 5.11.0 to 5.16.4

What happened:

existing passing tests broke.

image

Reproduction:

Problem description:

Upgrading a minor version shouldn't break existing APIs.

Suggested solution:

Make sure the implementation of toBeVisible and toBeInTheDocument work with jest-environment-node and jest-environment-jsdom not just jest-environment-jsdom.

It seems the usage of element.getRootNode in toBeVisible and toBeInTheDocument does not work when using jest-environment-node.

Is there a way to change the implementation so that it works in both environments?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant