testing-library / dom-testing-library

🐙 Simple and complete DOM testing utilities that encourage good testing practices.
https://testing-library.com/dom
MIT License
3.26k stars 466 forks source link

Custom testIdAttribute has no effect after upgrading to 8.19.1 #1199

Closed jarlef closed 1 year ago

jarlef commented 1 year ago

After bumping @testing-library/dom from 8.19.0 to 8.19.1 all the spec tests fails on the following line when using custom test attribute (data-eid)

await waitFor(() => screen.getByTestId('my-id'));`

setupTests.ts

configure({
  testIdAttribute: 'data-eid',
});

If i revert to use the default data-testid then getByTestId is able to fetch the element from the DOM

Relevant code or config:

configure({
  testIdAttribute: 'data-eid',
});
await waitFor(() => screen.getByTestId('my-id'));`

setupTests.ts

What you did:

Upgrade to latest version

What happened:

Reproduction:

Problem description:

Suggested solution:

eps1lon commented 1 year ago

You probably have multiple versions of @testing-library/dom or @testing-library/react installed. Make sure that only a single version of these libraries is installed. If you're unsure on how to do that, you can ask in the Testing Library Discord server.