-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
src: don't overwrite environment from .env file #49424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
edaa662
271bebd
f673db5
005da17
22dbae2
e9371df
d91ebce
56f0868
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,4 +35,29 @@ describe('.env supports edge cases', () => { | |
| assert.strictEqual(child.code, 0); | ||
| }); | ||
|
|
||
| it('should not override existing environment variables', async () => { | ||
| const code = ` | ||
| require('assert').strictEqual(process.env.BASIC, 'existing'); | ||
| `.trim(); | ||
| const child = await common.spawnPromisified( | ||
| process.execPath, | ||
| [ `--env-file=${validEnvFilePath}`, '--eval', code ], | ||
| { cwd: __dirname, env: { BASIC: 'existing' } }, | ||
| ); | ||
| assert.strictEqual(child.stderr, ''); | ||
| assert.strictEqual(child.code, 0); | ||
| }); | ||
|
|
||
| it('should override NODE_OPTIONS', async () => { | ||
|
||
| const code = ` | ||
| require('assert').strictEqual(process.env.NODE_OPTIONS, '--experimental-permission --allow-fs-read=*'); | ||
| `.trim(); | ||
| const child = await common.spawnPromisified( | ||
| process.execPath, | ||
| [ `--env-file=${relativePath}`, '--eval', code ], | ||
| { cwd: __dirname, env: { NODE_OPTIONS: '--experimental-permission --allow-worker' } }, | ||
| ); | ||
| assert.strictEqual(child.stderr, ''); | ||
| assert.strictEqual(child.code, 0); | ||
| }); | ||
| }); | ||
Uh oh!
There was an error while loading. Please reload this page.