-
-
Notifications
You must be signed in to change notification settings - Fork 153
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
Jest + Dotenv - Doesn't load env variables using "setupFilesAfterEnv" (ignored?) #4
Comments
I've created a sample that reproduce this issue at UnlyEd/boilerplates-generator#9 I basically copied an existing template with serverless and applied serverless-bundle, see |
I think we might not be passing those in. I'll need to investigate this. |
I looked at what Create React App does for this and added support to override some Jest options. https://github.com/AnomalyInnovations/serverless-bundle/releases/tag/v1.2.3 |
Interesting, I'm gonna give it a try! I tried running my test, and got:
|
|
The verbose option could be supported in a future version, meanwhile I believe we can close this issue ;) |
jest.config.js
jest.setup.js
.env
|
It looks like setupFilesAfterEnv in package.json is either ignored or misconfigured doc
My file
./jest-preload-env.js
contains the following:But adding console.log there doesn't seem to be executed.
This breaks my tests, as ENV variables aren't loaded before tests are executed.
I'm running
serverless-bundle test --watchAll --runInBand
, which seems to call jest (through , but after looking at the source, I believe thesetupFilesAfterEnv
is ignored by the plugin.The text was updated successfully, but these errors were encountered: