Kevin McKernan
05/03/2022, 11:11 PMNurul
05/11/2022, 8:37 AM@prisma/client
and jest-mock-extended
?Kevin McKernan
05/16/2022, 5:07 PMKevin McKernan
05/19/2022, 8:43 PM➜ yarn why prisma
yarn why v1.22.19
[1/4] � Why do we have the module "prisma"...?
[2/4] � Initialising dependency graph...
[3/4] � Finding dependency...
[4/4] � Calculating file sizes...
=> Found "prisma@3.14.0"
Kevin McKernan
05/19/2022, 8:43 PM➜ yarn why jest-mock-extended
yarn why v1.22.19
[1/4] � Why do we have the module "jest-mock-extended"...?
[2/4] � Initialising dependency graph...
[3/4] � Finding dependency...
[4/4] � Calculating file sizes...
=> Found "jest-mock-extended@2.0.6"
Kevin McKernan
05/19/2022, 8:44 PMKevin McKernan
05/19/2022, 8:44 PMimport prisma from "@db/prisma";
import type { PrismaClient } from "@prisma/client";
import type { DeepMockProxy } from "jest-mock-extended";
import { mockDeep, mockReset } from "jest-mock-extended";
jest.mock("@db/prisma", () => ({
__esModule: true,
default: mockDeep<PrismaClient>(),
}));
beforeEach(() => {
mockReset(prismaMock);
});
export const prismaMock = prisma as unknown as DeepMockProxy<PrismaClient>;
Kevin McKernan
05/19/2022, 8:44 PMKevin McKernan
05/19/2022, 8:44 PM● Test suite failed to run
TypeError: Cannot read properties of undefined (reading 'mockDeep')
6 | jest.mock("@db/prisma", () => ({
7 | __esModule: true,
> 8 | default: mockDeep<PrismaClient>(),
| ^
9 | }));
10 |
11 | beforeEach(() => {
at utils/testing/prisma-mock.ts:8:20
at Object.<anonymous> (utils/testing/prisma-mock.ts:1:32)
at Object.<anonymous> (utils/aws.test.ts:5:51)