You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Testing Framework and version: vitest version: 0.28.5 with @testing-library/react version: 14.0.0
DOM Environment: jsdom version: 21.1.0
Relevant code or config:
it('with fake timers, not working :(',async()=>{vi.useFakeTimers();render(<TestComponent/>);screen.getByText('Apple');vi.runOnlyPendingTimers();// this promise never resolves with fake timersawaitscreen.findByText('Pear');// restore to real timersvi.useRealTimers();});
@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
The text was updated successfully, but these errors were encountered: