[build-tools] Let updateEnv override existing values#3901
Conversation
updateEnv override existing values
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## stanley/env-allows-undefined #3901 +/- ##
================================================================
- Coverage 59.04% 59.02% -0.01%
================================================================
Files 935 935
Lines 40974 40946 -28
Branches 8632 8624 -8
================================================================
- Hits 24187 24165 -22
+ Misses 16691 16686 -5
+ Partials 96 95 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adjusts BuildContext.updateEnv in @expo/build-tools to behave like a true “update” operation by letting incoming env entries override existing ones, and adds a regression test to lock in override + “clear via undefined” behavior.
Changes:
- Changed
BuildContext.updateEnvmerge order so incomingenvvalues take precedence over the existing context env. - Added a unit test verifying overwriting an existing env var and clearing one by setting it to
undefined.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/build-tools/src/context.ts | Swap spread order in updateEnv so updates override existing env values. |
| packages/build-tools/src/tests/context.test.ts | Add regression test for overriding and clearing env entries via updateEnv. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e83065d to
e808064
Compare
b5c5e54 to
45c3357
Compare
e808064 to
43511f2
Compare
45c3357 to
1fcaa05
Compare
43511f2 to
5c24631
Compare
|
⏩ The changelog entry check has been skipped since the "no changelog" label is present. |
Summary
BuildContext.updateEnvso incoming values override existing env values.Why
This makes
updateEnvbehave like an update operation and lets callers intentionally refresh or clear existing environment entries.No idea how it existed so long like this. I guess the values we update with don't overlap with the values we already have that often.
Test Plan
CI should pass.