sodatea / vite-jest

First-class Vite integration for Jest
MIT License
401 stars 51 forks source link

import.meta compatibility #14

Closed ThomasFindlay closed 2 years ago

ThomasFindlay commented 2 years ago

It looks like vite-jest is not able to correctly handle accessing import.meta.env in components. I cloned the react-app-ts example and tried to use an env variable. However, I ended up with the "Invalid hook call" error.

image

image

Without import.meta.env, the tests passed successfully. Considering the fact that Vite is using import.meta for a few things, I think it would be great if vite-jest was able to process it.

sodatea commented 2 years ago

Fixed in 0.1.0