Quramy / jest-prisma

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

allow pass `timeout` option for interactive transaction #73

Closed mishio-n closed 1 year ago

mishio-n commented 1 year ago

When I use this library, I got timeout error of prisma transaction.

The error message is as follows.

Transaction API error: Transaction already closed: A query cannot be executed on an expired transaction. The timeout for this transaction was 5000 ms, however 9032 ms passed since the start of the transaction. Consider increasing the interactive transaction timeout or doing less work in the transaction.

I know that taking more than 5 seconds for one test case is not good. But, I thought it would be more useful to be able to set timeout value.

Is it possible to change the timeout via testEnvironmentOption in the same way as for maxWait?

Here is an example.

// jest.config.js
export default {
  testEnvironmentOptions: {
    maxWait: 10000,
    timeout: 10000,
  },
};

If all is well, I will create a pull request.