Quramy / jest-prisma

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

fix: don't show premature access warning on ES Module import #119

Closed germanescobar closed 9 months ago

germanescobar commented 9 months ago

We had a bunch of the following warnings when tests were starting up:

If you want to access Prisma client in beforeAll or afterAll, use jestPrisma.originalClient.
jsetPrisma.client should be used in test or beforeEach functions because transaction has not yet started.

The culprit was the ES Module system that asks for a property called __esModule on the proxied instance every time we import the module.

The changes in this PR are the following:

Quramy commented 9 months ago

@germanescobar Thanks for your PR !