From b24691efdb7c5df69bf3494fcf7053b0d4a02836 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Wed, 29 May 2024 17:29:23 +0200 Subject: [PATCH] feat: allow augmenting config.test.env (#5784) --- docs/config/index.md | 6 ++++++ packages/vitest/src/types/config.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/config/index.md b/docs/config/index.md index d22f89537b31..a17eca5be863 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -2292,3 +2292,9 @@ This is a low-level option and should be used only for advanced cases where you If you just need to configure snapshots feature, use [`snapshotFormat`](#snapshotformat) or [`resolveSnapshotPath`](#resolvesnapshotpath) options. ::: + +### env {#env} + +- **Type:** `Partial` + +Environment variables available on `process.env` and `import.meta.env` during tests. These variables will not be available in the main process (in `globalSetup`, for example). diff --git a/packages/vitest/src/types/config.ts b/packages/vitest/src/types/config.ts index 5124a3d47876..f3929bfe43c4 100644 --- a/packages/vitest/src/types/config.ts +++ b/packages/vitest/src/types/config.ts @@ -579,7 +579,7 @@ export interface InlineConfig { /** * Custom environment variables assigned to `process.env` before running tests. */ - env?: Record + env?: Partial /** * Options for @sinon/fake-timers