Skip to content

test: retain process.env when overriding NETLIFY vars - #8412

Merged
serhalp merged 1 commit into
netlify:mainfrom
43081j:jg/no-env-nukes
Aug 14, 2026
Merged

test: retain process.env when overriding NETLIFY vars#8412
serhalp merged 1 commit into
netlify:mainfrom
43081j:jg/no-env-nukes

Conversation

@43081j

@43081j 43081j commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

The previous code was nuking the entire process.env which meant some built-in tools like os.tmpdir() would be undefined on Windows (as it depends on env.TEMP or some such thing existing).

We should be able to safely extend the existing env instead of overwriting it.

I suspect this will fix:
https://github.com/netlify/cli/actions/runs/31727425876/job/94549735809#step:10:286

Since that error happens when joining an undefined tmpdir.


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures we
    can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or
    something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures your code follows our style guide and
    passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)

The previous code was nuking the entire `process.env` which meant some built-in
tools like `os.tmpdir()` would be `undefined` on Windows (as it depends on
`env.TEMP` or some such thing existing).

We should be able to safely extend the existing env instead of overwriting it.
@43081j
43081j requested a review from a team as a code owner August 13, 2026 22:29
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3a9503e1-d57d-4244-84ce-05505f6cc6f1

📥 Commits

Reviewing files that changed from the base of the PR and between 66797b6 and ae9b63e.

📒 Files selected for processing (1)
  • tests/integration/commands/build/build-program.test.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • netlify/blueprints (manual)

📝 Walkthrough

Summary by CodeRabbit

  • Tests

    • Improved build validation to retain existing environment settings while applying test-specific API configuration.
    • This strengthens test reliability and reduces the risk of environment-related inconsistencies during build verification.
  • User Impact

    • No direct user-facing changes are included in this update.

Walkthrough

The build integration test now merges the original process environment with mock API variables before running the build. It no longer replaces the complete environment.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Mergeability Score: ⚪ Minimal · up to ae9b6

This is a localized test-only change with no actionable merge-blocking risk remaining after normal checks and review.

Suggested reviewers: amun-sihra

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the test change that retains process.env while overriding NETLIFY variables.
Description check ✅ Passed The description explains the process.env issue, its Windows impact, and the test change that addresses it.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Aug 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/netlify-cli@8412

commit: ae9b63e

@serhalp
serhalp enabled auto-merge (squash) August 14, 2026 02:20

@serhalp serhalp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏🏼 thank you!

@serhalp
serhalp merged commit b7446cb into netlify:main Aug 14, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants