You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
consttransaction=async(prisma)=>{awaitprisma.$transaction(async(p)=>{awaitp.user.create({data: {/* */}})thrownewError("Something failed. Affected changes will be rollback.")}).catch(console.error)}// test codeit("test",async()=>{constprisma=jestPrisma.clientconstbefore=awaitprisma.user.aggregate({_count: true})expect(before._count).toBe(0)awaittransaction(prisma)constafter=awaitprisma.user.aggregate({_count: true})expect(after._count).toBe(0)// Prisma is expected to rollback, so there should be no increase in users})
Expected
The following tests succeed
Actual
Reproduction
Please check the code I forked.
https://github.com/YutaUra/jest-prisma/blob/reproducing_transaction_bug/examples/example-prj/src/service/Transaction.ts
https://github.com/YutaUra/jest-prisma/blob/reproducing_transaction_bug/examples/example-prj/src/service/Transaction.test.ts
Others
Is the unavailability of Transaction a bug or a specification?
If it is a specification at this time, I think documentation needs to be added. If so, I would be happy to help.
The text was updated successfully, but these errors were encountered: