Skip to content

[browser] Allow dynamic process.env in browser mode #6667

@JCQuintas

Description

@JCQuintas

Clear and concise description of the problem

Currently process.env.NODE_ENV gets replaced by its actual value when vitest is run in browser mode.

This behaviour defeats some parts of component testing, when we want to actually test the behaviour of our component in different environments. Eg: by throwing in development vs warning in production.

Suggested solution

Allow process.env to be dynamic in browser mode

Alternative

No response

Additional context

If you need a quick testing example 🙃
https://github.com/JCQuintas/vitest-browser-process-env

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: browserIssues and PRs related to the browser runnerp2-nice-to-haveNot breaking anything but nice to have (priority)

    Type

    No type

    Projects

    Status

    Approved

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions