getting a typescript error when trying to use drizzle.mock()

I'm trying to mock my drizzle driver for some unit tests. I'm using drizzle.mock(). When I pass it into the function that takes it, I get the following error:

Argument of type
NodePgDatabase<Record<string, never>> & {
    $client: "$client is not available on drizzle.mock()";
}
is not assignable to parameter of type
NodePgDatabase<typeof import("/home/nico/src/idem/packages/backend/src/db/schema")> & {
    $client: Pool;
}
Type
NodePgDatabase<Record<string, never>> & {
    $client: "$client is not available on drizzle.mock()";
}
is not assignable to type
NodePgDatabase<typeof import("/home/nico/src/idem/packages/backend/src/db/schema")>


I tried to modify the property, to have a null pool, but I get another error telling me that type Pool isn't compatible with the prop's type.

how do I mock the driver? I've been at it for the past couple of days and am super confused 😖
Was this page helpful?