Skip to content

Commit

Permalink
Fix unreadable Prisma errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperpeulen committed May 15, 2024
1 parent d8a1580 commit ec7bdc9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/db.mock.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Prisma, type PrismaClient } from '@prisma/client'
import { Prisma, type PrismaClient } from '@prisma/client'
import { fn, isMockFunction } from '@storybook/test'
import createPrismaMock from 'prisma-mock'
import json from '#prisma/dmmf.json'
Expand Down Expand Up @@ -30,4 +30,9 @@ export function initializeDB(
data: Parameters<typeof createPrismaMock<PrismaClient>>[0] = {},
) {
db = createPrismaClientMock(data)

// @ts-ignore This Error class is not loaded properly in the browser, mocking it for now like a regular Error
Prisma.PrismaClientKnownRequestError = class PrismaClientKnownRequestError extends (
Error
) {}
}

0 comments on commit ec7bdc9

Please sign in to comment.