prismock icon indicating copy to clipboard operation
prismock copied to clipboard

TypeError: Cannot read properties of undefined (reading 'dmmf')

Open ishaangandhi opened this issue 9 months ago • 1 comments

I am using Prismock and am getting this error when creating a new PrismaClient:

 FAIL  src/lessons/views.test.ts
  ● Test suite failed to run

    TypeError: Cannot read properties of undefined (reading 'dmmf')

       7 | export const db =
       8 |   globalForPrisma.prisma ||
    >  9 |   new PrismaClient({
         |   ^
      10 |     log:
      11 |       process.env.NODE_ENV === "development"
      12 |         ? ["query", "error", "warn"]

      at Prismock.generate (../../node_modules/prismock/src/lib/client.ts:67:84)
      at new Prismock (../../node_modules/prismock/src/lib/client.ts:59:12)
      at Object.<anonymous> (../db/index.ts:9:3)

prismock verson: prismock@^1.31.0 prisma version: prisma@^4.15.0

Is there a version of the libraries that is tested together that is known to work?

ishaangandhi avatar May 08 '24 19:05 ishaangandhi

Hello @ishaangandhi, by any chance can you submit the code you use to mock prisma?

Also, if you didn’t yet, please have a look at https://github.com/morintd/prismock/issues/895.

morintd avatar May 11 '24 11:05 morintd