I'm trying to set up my testing environment using the Prisma docs and it's been a bit of a trainwreck. So, I'm working backward trying to figure out why it's not working. I have the setup of the singleton.ts
file shown below, and when I try initiate my tests it fails with the following error: TypeError: Cannot read property '_isMockObject' of undefined
singleton.ts
import { PrismaClient } from '@prisma/client';
import { mockDeep, mockReset, DeepMockProxy } from 'jest-mock-extended';
// import { $prisma } from './client';
export const prisma = new PrismaClient();
jest.mock('./client', () => ({
__esModule: true,
default: mockDeep<PrismaClient>(),
}));
beforeEach(() => {
mockReset(prismaMock);
});
export const prismaMock = prisma as unknown as DeepMockProxy<PrismaClient>;
someTest.test.ts
it('should pass', () => {
//
});
Creates this error: