-
Notifications
You must be signed in to change notification settings - Fork 467
Closed as not planned
Description
@testing-library/domversion: 9.0.0- Testing Framework and version:
vitestversion: 0.28.5 with@testing-library/reactversion: 14.0.0 - DOM Environment:
jsdomversion: 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 timers
await screen.findByText('Pear');
// restore to real timers
vi.useRealTimers();
});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
bc-m, saltenhub, atdrago, timdown and reysmerwvr
Metadata
Metadata
Assignees
Labels
No labels