Use drizzle with useFakeTimer
Hello everyone!
At my job we've been working with Drizzle for a few months now and it offers a really nice developer experience, congrats 👍
Recently we hit a wall: in a test (vitest) we use
useFakeTimers
, which mocks the javascript date and time objects (https://vitest.dev/api/vi.html#vi-usefaketimers)
When we call any database query (transaction, insert, query, ...) the script is blocked and the test times out.
I think it's due to the database (we use drizzle-orm/postgres-js
and postgres
), but maybe someone here have an idea?Vitest
Next generation testing framework powered by Vite
1 Reply
For the record, it works with this code:
I suppose useFakeTimers mocks something that is used by postgres in a way that disturbs postgres, thus creating an issue.