Quramy / jest-prisma

Jest environment for integrated testing with Prisma client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add option for TransactionIsolationLevel setting

danielpowell4 opened this issue · comments

First up: thanks for this awesome library. It has transformed my day-to-day in a great way!

I'm wondering if you are interested in a pull request to expose 'isloationLevel' as a setting that can be defined for transactions

As context, we're seeing some deadlocks in our growing test suites due to various tests and factories trying to create default users in our test setup. I believe that changing from the postgres default of 'Read Committed' to 'Serializable' would help us

As of a few days ago, Prisma itself merged a PR to allow these transaction options to be set on the PrismaClient via a new transactionOptions setting per prisma/prisma#19592

I believe it would most need to be added here with a safe default of 'undefined'

{
maxWait: this.options.maxWait ?? DEFAULT_MAX_WAIT,
timeout: this.options.timeout ?? DEFAULT_TIMEOUT,
},

More reading:
https://www.prisma.io/docs/orm/prisma-client/queries/transactions#transaction-isolation-level

Prisma support + database defaults:
https://www.prisma.io/docs/orm/prisma-client/queries/transactions#supported-isolation-levels

Closed via #132