Skip to content

After using this with parsed values, no longer possible to mock import.meta.env in vitest tests #52

Description

@fnimick

Assigning import.meta.env.VITE_MY_BOOLEAN = false in the test sets it to the string 'false' instead. Code that relies on the parsed import.meta.env to be the literal boolean now fails.

This is the recommended approach from the vitest documentation: https://vitest.dev/guide/mocking.html#mock-import-meta-env

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions