forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-assigning `process.env` substitutes the "magic object" that sets environment variables at the process level with an ordinary JavaScript object. This causes environment variables that are set after `process.env` is re-assigned to not be visible to native add-ons. See [this Node.js issue][issue] and [this reproduction case][repro] for details. [issue]: nodejs/node#46996 [repro]: https://github.com/unflxw/nodejs-process-env-addons-repro
- Loading branch information
Showing
2 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { loadEnvConfig } from '../../packages/next-env/' | ||
|
||
describe('preserve process env', () => { | ||
it('should not reassign `process.env`', () => { | ||
const originalProcessEnv = process.env | ||
loadEnvConfig('.') | ||
expect(Object.is(originalProcessEnv, process.env)).toBeTrue() | ||
}) | ||
}) |