You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vitest doesn't support Node.js arguments and we don't have plans to support them. If you need to use .env file, you can use --mode flag that will use your local .env.{mode} by default. Note that envs need to start with VITE_ by default, but it can be configured with envPrefix.
Vitest doesn't support Node.js arguments and we don't have plans to support them. If you need to use .env file, you can use --mode flag that will use your local .env.{mode} by default. Note that envs need to start with VITE_ by default, but it can be configured with envPrefix.
i had no idea it was intentional, i will try an alternative approach, thanks.
You can also pass NodeJS exec arguments to test runner threads/processes. Note that these won't be available in main thread, e.g. reporters or global setup.
import{defineConfig}from"vitest/config";exportdefaultdefineConfig({test: {poolOptions: {forks: {execArgv: ["--env-file=.env.custom"]},// or threads if that pool is usedthreads: {execArgv: ["--env-file=.env.custom"]},},},});
Activity
sheremet-va commentedon Aug 24, 2024
Vitest doesn't support Node.js arguments and we don't have plans to support them. If you need to use
.envfile, you can use--modeflag that will use your local.env.{mode}by default. Note that envs need to start withVITE_by default, but it can be configured withenvPrefix.sombriks commentedon Aug 24, 2024
i had no idea it was intentional, i will try an alternative approach, thanks.
sombriks commentedon Aug 24, 2024
My usecase is vitest on backend, testing fastiify running under tsx.
So the VITE_ prefix could be troublesome, since i only need vitest, not vite.
this config is my current workaround:
AriPerkkio commentedon Aug 25, 2024
You can also pass NodeJS exec arguments to test runner threads/processes. Note that these won't be available in main thread, e.g. reporters or global setup.
https://vitest.dev/config/#pooloptions-forks-execargv