npx
command not found when calling exec
in test
#2948
-
Hey, so I'm trying to run my integration tests in parallel against a real DB. For this, I'm using a different schema for each of my test files. Each of these needs to be migrated to reflect my schema. Since I'm using prisma, where migrate is only a CLI command, I try to run it via test.before(async (t) => {
const dbUrl = `postgresql://admin:test@localhost:5432/db?schema=pluginPrisma&connection_limit=1`;
execSync("npx prisma migrate dev", {
env: {
DATABASE_URL: dbUrl,
},
});
// ... rest of before
} But I'm getting the following error when running my tests:
Same goes for running I'm using ava 4.0.1 and guess this has something to do with the thread isolation. Any ideas on how to work around this? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
My guess is that the way you provide the env object your other environment variables may not be passed through, meaning that PATH is empty and the child process can't find npx. ls is built-in so works. I don't expect this to be related to the worker threads. |
Beta Was this translation helpful? Give feedback.
My guess is that the way you provide the env object your other environment variables may not be passed through, meaning that PATH is empty and the child process can't find npx. ls is built-in so works. I don't expect this to be related to the worker threads.