-
Notifications
You must be signed in to change notification settings - Fork 0
Labels
bugSomething isn't workingSomething isn't working
Description
Need to add this line on the test property on the vitest.config.json:
import { loadEnv } from 'vite'
import { defineConfig } from 'vitest/config'
export default defineConfig(({ mode }) => ({
test: {
// mode defines what ".env.{mode}" file to choose if exists
env: loadEnv(mode, process.cwd(), ''),
},
}))You can create a file .env.test with all your environment variables set for the test cases.
NB: Add a piece of advice to use vi.stubEnv from vi-stubenv to stub env variables for tests and don't forget to clear it with the vi.unstubAllEnvs
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working