typegoose/mongodb-memory-server

[SOLUTION] Jest and Fake Timers

DominicVonkPON opened this issue · 2 comments

Discussed in #823

Originally posted by DominicVonkPON October 30, 2023
If you encounter a problem with Jest where the tests are not running due to the fake timers, it could be because MongoDB memory server relies on nextTick. To resolve this issue, you should avoid faking the nextTick function. By allowing the natural behavior of nextTick, you should be able to run the tests successfully with Jest.

jest.useFakeTimers({
      doNotFake: ['nextTick'], // do not fake nextTick behavior for mongo in memory
});

why exactly was this opened as a issue too?