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
Using fake timers in multiple tests freezes the execution, with no other option but to kill the process.
import dayjs from "dayjs";
const now = dayjs();
beforeEach(async () => {
jest.useFakeTimers().setSystemTime(now.toDate());
})
afterEach(async () => {
jest.useRealTimers();
})
Calling jest.useRealTimers(); in afterEach as suggested here doesn't help unfortunately. Sorry I took so long go get back to creating a dedicated issue.
The text was updated successfully, but these errors were encountered:
alucryd
changed the title
Using jest's fake timers completely freeze test execution
Using jest's fake timers completely freezes test execution
Jan 30, 2024
I am investigating a related issue, but i cannot reproduce it with your example. My issue was that some of my code was running which was depending on the time, and the promise never resolved. Could you debug your code to figure out on which line it is stopping? Or even better, create a minimal reproducible example, so we can reproduce it locally, see https://stackoverflow.com/help/minimal-reproducible-example . We would need a whole git repository with configuration and all the files, and the commands to reproduce the freeze.
Using fake timers in multiple tests freezes the execution, with no other option but to kill the process.
Calling
jest.useRealTimers();
inafterEach
as suggested here doesn't help unfortunately. Sorry I took so long go get back to creating a dedicated issue.The text was updated successfully, but these errors were encountered: