Quramy / jest-prisma

Jest environment for integrated testing with Prisma client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: Output SQL Queries with Parameters

kz-d opened this issue · comments

commented

Thank you for developing this useful tool!

I've been looking for a way to output SQL queries along with their parameters.
Currently, the verboseQuery option does allow for SQL logs to be outputted, but it doesn't include the parameters.

A possible workaround could be the following code snippet, but it tends to be a bit clunky and output some unnecessary logs.

beforeAll(async () => {
   jestPrisma.originalClient.$on("query", (event) => {
      console.debug({ event })
   })
})

prisma/prisma#5026

Since this is a tool for testing, how about adding an option like verboseQueryWithParameters or making it default to output parameters?

If that's acceptable, I will create a pull request.

commented

HI @Quramy
Would you have a moment to revisit this feature request? It seems to have garnered some positive reactions.