Omit on PrismaClient
mallonenogueira opened this issue · 1 comments
mallonenogueira commented
Hi,
I would like to know if it’s possible to pass the omit
attribute to the client.
Here’s my current setup:
// config/prisma
import { PrismaClient } from "@prisma/client";
export const prisma = new PrismaClient({
log: ['query', 'info', 'warn', 'error'],
omit: {
user: {
password: true,
},
},
});
// setup
import { vi } from "vitest";
vi.mock(import("../config/prisma"), async () => {
const mockImport = await import("../__mock__/prisma.mock");
return mockImport;
});
///__mock__/prisma.mock"
import { mockDeep } from "vitest-mock-extended";
import createPrismaMock from "prisma-mock";
import { Prisma, PrismaClient } from "@prisma/client";
export const prisma = createPrismaMock<PrismaClient>(
{},
Prisma.dmmf.datamodel,
mockDeep()
);
Let me know if you need anything else!
stijnvanderlaan commented
Hi @mallonenogueira, no this is not yet supported. I'll explore the possibility of adding this feature in the near future.