From 744bd732a6949fcd7c2aa3ffccd073799773f5ef Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Wed, 15 Jul 2020 12:14:41 -0500 Subject: [PATCH] fix: remove NODE_ENV variable by default BREAKING CHANGE: The default for Environment Deletions setting changed from `[]` to `["NODE_ENV"]` To restore previous behavior change the setting to `[]` --- spec/config-spec.js | 2 +- spec/element-spec.js | 8 +++++++- spec/profiles-spec.js | 2 +- src/config.js | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/spec/config-spec.js b/spec/config-spec.js index ca868387..7a19aec9 100644 --- a/spec/config-spec.js +++ b/spec/config-spec.js @@ -157,7 +157,7 @@ describe('Call to setEnv()', () => { describe('Call to deleteEnv()', () => { it('return []', () => { - expect(configDefaults.deleteEnv).toBe('[]') + expect(configDefaults.deleteEnv).toBe('["NODE_ENV"]') }) }) diff --git a/spec/element-spec.js b/spec/element-spec.js index d6343d1e..3b52b35e 100644 --- a/spec/element-spec.js +++ b/spec/element-spec.js @@ -236,7 +236,13 @@ describe('XTerminalElement', () => { }) it('getEnv()', () => { - expect(JSON.stringify(this.element.getEnv())).toEqual(JSON.stringify(process.env)) + const NODE_ENV = process.env.NODE_ENV + try { + delete process.env.NODE_ENV + expect(JSON.stringify(this.element.getEnv())).toEqual(JSON.stringify(process.env)) + } finally { + process.env.NODE_ENV = NODE_ENV + } }) it('getEnv() env set in uri', async () => { diff --git a/spec/profiles-spec.js b/spec/profiles-spec.js index 873d0334..ce9a7516 100644 --- a/spec/profiles-spec.js +++ b/spec/profiles-spec.js @@ -41,7 +41,7 @@ describe('XTerminalProfilesSingleton', () => { projectCwd: true, env: null, setEnv: {}, - deleteEnv: [], + deleteEnv: ['NODE_ENV'], encoding: null, fontSize: 14, fontFamily: 'monospace', diff --git a/src/config.js b/src/config.js index 7db3cd00..c5e2b26f 100644 --- a/src/config.js +++ b/src/config.js @@ -33,7 +33,7 @@ export function resetConfigDefaults () { webLinks: true, env: '', setEnv: '{}', - deleteEnv: '[]', + deleteEnv: '["NODE_ENV"]', encoding: '', fontSize: 14, // NOTE: Atom will crash if the font is set below 8.