Skip to content

Commit b7446cb

Browse files
authored
test: retain process.env when overriding NETLIFY vars (#8412)
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](https://github.com/netlify/cli/issues/new/choose) 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. - [x] Read the [contribution guidelines](../CONTRIBUTING.md) 📖. This ensures your code follows our style guide and passes our tests. - [x] Update or add tests (if any source code was changed or added) 🧪 - [ ] Update or add documentation (if features were changed or added) 📝 - [x] Make sure the status checks below are successful ✅ **A picture of a cute animal (not mandatory, but encouraged)**
1 parent 66797b6 commit b7446cb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tests/integration/commands/build/build-program.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe('command/build', () => {
7171
// eslint-disable-next-line no-restricted-properties
7272
process.cwd = () => builder.directory
7373
await withMockApi(routes, async ({ apiUrl }) => {
74-
process.env = getEnvironmentVariables({ apiUrl })
74+
process.env = { ...originalEnv, ...getEnvironmentVariables({ apiUrl }) }
7575

7676
await builder.withNetlifyToml({ config: {} }).withStateFile({ siteId: siteInfo.id }).build()
7777

0 commit comments

Comments
 (0)