dotenv-run
dotenv-run copied to clipboard
How to use with jest?
TypeError: Cannot read properties of undefined (reading 'NG_APP_GRAPHQL_ENDPOINT')
1 | export const environment = {
> 2 | graphqlEndpoint: import.meta.env.NG_APP_GRAPHQL_ENDPOINT
| ^
3 | }
at src/app/environment.ts:2:38
Looks like @ngx-env/builder is not loaded, how I can setup env from code. I would probably put it in setupJest.ts file, where it will be loaded on jest startup.
Yes, the same question
same issue, no idea how to setup jest tests with this great library
I've just released a package that should help with the setup. https://www.npmjs.com/package/@dotenv-run/jest-angular
Could you please give it a try?