Allow augmentation of env
in the InlineConfig
interface for type-safe env vars,
#5780
Closed
4 tasks done
Labels
Clear and concise description of the problem
I want to pass down a config-defined env var via a global setup file to test files with
provide()
, and have it be type-safe all the way through.provide()
can be made type safe viaProvidedContext
, butInlineConfig.env
cannot be.When writing
and
I would like
MY_CUSTOM_ENV
to be type-safe and have autocompletion in:defineConfig()
'stest.env
globalSetup.ts
'sconfig.env
I attempted to augment the
InlineConfig
interface:but as expected, this results in:
Considering I'm used to overriding
import.meta.env
in Vite, and since declaration-mergingProvidedContext
works great as well, I'd like the same capability forInlineConfig
.Suggested solution
Instead of
env
should have its own augmentable interface, similar to howProvidedContext
works, e.g.Also, it seems
.env
is not documented at all over at https://vitest.dev/config/, even though it looks like part of the stable public API, has JSDoc and everything.Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: