<https://www.prisma.io/docs/guides/testing/integra...
# prisma-client
m
https://www.prisma.io/docs/guides/testing/integration-testing#running-the-tests This says
"migrate:init": "npx prisma migrate dev --name init"
- why the
--name init
bit?
j
I think this part is not super well thought 🤔
--name init
is optional by the way, running
npx prisma migrate dev
will ask for a name if a migration needs to be created
Here
migrate deploy
would make a lot more sense, you don’t want to create a migration in a test
m
nice 🙂
I added this to my
jest.config.js
Copy code
// for prisma integration tests
// run `npm run prepare:test` in repo to make sure pg docker is running
require("dotenv-flow").config({
  default_node_env: "test",
  path: path.join(__dirname, "packages", "repo", "prisma"),
})
👍 1
so it grabs the .env.test guy
also I had to slightly modify
truncateAllTables
because it's not valid typescript
👀 1
j
Note: It’s valid, if you see something we could improve let us know 🙂
m
valid JS but not TS if you have strict mode on I believe
j
I see
Thanks!
👍 1
m
I think you can pass the
Array<{ tablename: string }> =
as a type param to $queryRaw?
1
👍 1