Quramy / jest-prisma

Jest environment for integrated testing with Prisma client
MIT License
266 stars 15 forks source link

Feature Request: Transaction Rollback Support #88

Closed YutaUra closed 1 year ago

YutaUra commented 1 year ago

Currently, jest-prisma is not able to reproduce the phenomenon of rollback in transactions, but it would be better if it could!

see: https://github.com/Quramy/jest-prisma/issues/87

YutaUra commented 1 year ago

Perhaps this could be accomplished by setting up a SAVEPOINT or something like that

postgres: https://www.postgresql.org/docs/15/sql-savepoint.html mysql: https://dev.mysql.com/doc/refman/8.0/en/savepoint.html sqlite: https://www.sqlite.org/lang_savepoint.html

YutaUra commented 1 year ago

Released in version 1.5.0 🎉

Set enableExperimentalRollbackInTransaction in testEnvironmentOptions to true.

/* jest.config.mjs */
export default {
  testEnvironment: "@quramy/jest-prisma/environment",
  testEnvironmentOptions: {
    enableExperimentalRollbackInTransaction: true, // <- add this
  },
};