Closed JZalfen closed 1 year ago
With @testing-library/react
version 13.4.0 (using @testing-library/dom
version 8.20.0) it works.
Stackblitz: https://stackblitz.com/edit/vitejs-vite-mfzplb?file=src/TestComponent.spec.tsx
So it looks like a regression of @testing-library/dom
version 9.
For me vi.useFakeTimers({ shouldAdvanceTime: true });
fixed it for @testing-library/dom
v9:
https://stackblitz.com/edit/vitejs-vite-jjkbqn?file=src/TestComponent.spec.tsx
We don't support automatic advancement of fake timers outside of Jest. Closing as a duplicate of https://github.com/testing-library/dom-testing-library/issues/987
@testing-library/dom
version: 9.0.0vitest
version: 0.28.5 with@testing-library/react
version: 14.0.0jsdom
version: 21.1.0Relevant code or config:
What you did:
Using "useFakeTimers" with "findBy*" queries.
What happened:
Timeout on first usage of "screen.findByText".
Reproduction:
Stackblitz: https://stackblitz.com/edit/vitejs-vite-fwc91c?file=src/TestComponent.spec.tsx To run test: execute "vitest" in terminal
Problem description:
The test runs into a timeout.
Suggested solution:
none