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
See [`Improving Performance | Sharding`](/guide/improving-performance#sharding) for more information.
246
+
247
+
## Environment Variables
248
+
249
+
Vitest exclusively autoloads environment variables prefixed with `VITE_` from `.env` files to maintain compatibility with frontend-related tests, adhering to [Vite's established convention](https://vitejs.dev/guide/env-and-mode.html#env-files). To load every environmental variable from `.env` files anyway, you can use `loadEnv` method imported from `vite`:
250
+
251
+
```ts twoslash
252
+
import { loadEnv } from'vite'
253
+
import { defineConfig } from'vitest/config'
254
+
255
+
exportdefaultdefineConfig(({ mode }) => ({
256
+
test: {
257
+
// mode defines what ".env.{mode}" file to choose if exists
0 commit comments