-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Environment Variables in Test #20717
Comments
Yes, you can access env vars in test using |
I just have the .env file in a format like ENV_VARIABLE=the-value What i did to get it working was create a .env.ts file and use the I was unable to get it working by simply having the .env file at the root (as does work in a |
I should also note this is the command i had tried at one point to try and register the .env file:
|
I think you're wanting the For now, there's the deno_std module: https://deno.land/std@0.203.0/dotenv/mod.ts // add this to your code
import "https://deno.land/std@0.203.0/dotenv/load.ts"; |
Perfect, thank you, this was exactly what i needed. Thanks again for the help. |
Hey, I am curious as to if deno test supports the environment variables? It seems that maybe it doesn't as my tests do not work when they rely on environment variables. Variables are just set in a .env file, should this work with tests?
The text was updated successfully, but these errors were encountered: