react-native-dotenv
react-native-dotenv copied to clipboard
Add option to ignore process.env when on CI
My team found during an upgrade to react native, along with many other packages, that a change occurred that caused our .env.test
to be ignored in favour of the environment variables injected via the CI. This appeared to only be the case when running yarn test --coverage
.
Interestingly, when changing the coverageProvider
to "v8", the environment variables were correct. But that didn't solve all our issues and raised other significantly complex issues.
Part of the solution took inspiration from this PR: https://github.com/ember-cli/babel-plugin-ember-modules-api-polyfill/pull/156/files#diff-bfe9874d239014961b1ae4e89875a6155667db834a410aaaa2ebe3cf89820556
Link to issue
fixes #410 This is a solution we felt that the community might benefit from.
Description of changes being made
- An extra option of
ci
has been added, which will allow theprocess.env
variables to be ignored. The reason we got into this scenario was due to the environment variables in Circle CI being included in the initial temporary object and then subsequent values appeared to be ignored. - The update to
ImportDeclaration()
was a fix (link up above) for "container is falsey" that was found when runningyarn jest --coverage
. - Both changes were required to solve the overall issue.