-
-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Different Modes #511
Comments
You can assign a |
Thanks for the response, @sheremet-va. Unfortunately as I mentioned in the original post, I already tried to set MODE in Which config are you referring to with regards to defining the |
Is there any reason why you won't just set export default defineConfig({
mode: 'vitest',
}) |
Yeah, we're passing in the mode like this: export default defineConfig(({ mode }) => {
// Load env file based on `mode` in the current working directory.
const env = loadEnv(mode, process.cwd()); So |
I'm also facing this problem. I've tried both the nodeEnv approach and setting my vite.config.ts to set the mode. Neither seems to work. Also, it is not clear to me how the extension knows where the vite.config.ts file is located. Can someone who has this sorted out provide an example? |
Clear and concise description of the problem
I have joined a project where the Mode expected for running Vitest is
vitest
, for example, this NPM script frompackage.json
:vitest * --mode vitest
In this case, Vitest will look for the environment variable file
.env.vitest
. I would prefer not to have to rename this file as its use is already well established.I can see that
process.env.MODE
is present and set totest
, but overriding it in settings has no effect; perhaps it is being set after reading settings?I can confirm that changing the filename to
.env.test
does allow it to be loaded.Please provide a means to specify the mode used by the Vitest extension.
Suggested solution
Support a setting like the following:
Apply this value to the environment variable
MODE
, or continue to use the valuetest
if not set.Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: