Hi, everyone 👋
Do you guys have any examples of a setup using Prisma Client from Cypress tests? I am currently using cy.task to execute a node process but this is forcing me to create a task for every query I need to perform, which is cumbersome
🤔 1
a
Andrew Ross
12/22/2021, 3:57 AM
You could use module augmentation to bring Prisma into cypress or vice versa. Or, instantiate a Prisma client handler that's bound to the Global object
typeof globalThis
Something like this for the global handler
Andrew Ross
12/22/2021, 3:58 AM
Else, augmentation should do the trick. I augment Nextjs and other libraries on most projects to inject the root with global context types of utility (the normalized cache object of Apollo client or the users session, for example, anchored to pageProps with strongly typed definitions)
Andrew Ross
12/22/2021, 3:59 AM
Andrew Ross
12/22/2021, 4:00 AM
The file that the next/app module is declared in is in my project types directory, titled next.d.ts