From 9f2968b434040da85e0f88f87e165bdb81c115cd Mon Sep 17 00:00:00 2001 From: Chrilleweb Date: Sun, 29 Mar 2026 17:06:25 +0200 Subject: [PATCH 1/2] fix: added more to default exclude keys --- .changeset/sunny-eyes-admire.md | 5 +++++ docs/configuration_and_flags.md | 10 ++++++++++ packages/cli/src/core/filterIgnoredKeys.ts | 10 ++++++++++ 3 files changed, 25 insertions(+) create mode 100644 .changeset/sunny-eyes-admire.md diff --git a/.changeset/sunny-eyes-admire.md b/.changeset/sunny-eyes-admire.md new file mode 100644 index 0000000..340e75d --- /dev/null +++ b/.changeset/sunny-eyes-admire.md @@ -0,0 +1,5 @@ +--- +'dotenv-diff': patch +--- + +added more default exclude keys diff --git a/docs/configuration_and_flags.md b/docs/configuration_and_flags.md index 78006b8..89c0eb9 100644 --- a/docs/configuration_and_flags.md +++ b/docs/configuration_and_flags.md @@ -161,6 +161,16 @@ Specify a comma-separated list of keys to ignore during the comparison other tha - `CI` - `GITHUB_ACTIONS` - `INIT_CWD` +- `PORT` +- `PATH` +- `HOME` +- `USER` +- `SHELL` +- `LANG` +- `TMP` +- `TEMP` +- `TMPDIR` +- `NODE_PATH` This is useful when you have certain environment variables that are expected to differ between environments and you want to exclude them from the comparison. diff --git a/packages/cli/src/core/filterIgnoredKeys.ts b/packages/cli/src/core/filterIgnoredKeys.ts index 3dcdcf7..d36e816 100644 --- a/packages/cli/src/core/filterIgnoredKeys.ts +++ b/packages/cli/src/core/filterIgnoredKeys.ts @@ -15,6 +15,16 @@ export const DEFAULT_EXCLUDE_KEYS = [ 'GITHUB_ACTIONS', 'INIT_CWD', 'TZ', + 'PORT', + 'PATH', + 'HOME', + 'USER', + 'SHELL', + 'LANG', + 'TMP', + 'TEMP', + 'TMPDIR', + 'NODE_PATH', ]; /** From b2a1fdeee680f964bf6a1edcaf2f908d54117e2c Mon Sep 17 00:00:00 2001 From: Chrilleweb Date: Sun, 29 Mar 2026 17:17:58 +0200 Subject: [PATCH 2/2] chore: updated tests --- .../cli/test/unit/core/compare/parseAndFilterEnv.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cli/test/unit/core/compare/parseAndFilterEnv.test.ts b/packages/cli/test/unit/core/compare/parseAndFilterEnv.test.ts index c232045..f9cdecc 100644 --- a/packages/cli/test/unit/core/compare/parseAndFilterEnv.test.ts +++ b/packages/cli/test/unit/core/compare/parseAndFilterEnv.test.ts @@ -223,9 +223,9 @@ BAZ= it('handles special characters in values', () => { fs.writeFileSync( envPath, - 'URL=https://example.com?foo=bar&baz=qux\nPATH=/usr/local/bin\n', + 'URL=https://example.com?foo=bar&baz=qux\nDB_PATH=/usr/local/bin\n', ); - fs.writeFileSync(examplePath, 'URL=\nPATH=\n'); + fs.writeFileSync(examplePath, 'URL=\nDB_PATH=\n'); const opts: ComparisonOptions = { checkValues: false, @@ -237,7 +237,7 @@ BAZ= const result = parseAndFilterEnv(envPath, examplePath, opts); expect(result.current.URL).toContain('https://'); - expect(result.current.PATH).toBe('/usr/local/bin'); + expect(result.current.DB_PATH).toBe('/usr/local/bin'); }); it('handles keys with dots and hyphens', () => {