Skip to content

Commit 2abfab8

Browse files
authored
fix: added more to default exclude keys (#361)
* fix: added more to default exclude keys * chore: updated tests
1 parent 13f4df6 commit 2abfab8

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

.changeset/sunny-eyes-admire.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'dotenv-diff': patch
3+
---
4+
5+
added more default exclude keys

docs/configuration_and_flags.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,16 @@ Specify a comma-separated list of keys to ignore during the comparison other tha
161161
- `CI`
162162
- `GITHUB_ACTIONS`
163163
- `INIT_CWD`
164+
- `PORT`
165+
- `PATH`
166+
- `HOME`
167+
- `USER`
168+
- `SHELL`
169+
- `LANG`
170+
- `TMP`
171+
- `TEMP`
172+
- `TMPDIR`
173+
- `NODE_PATH`
164174

165175
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.
166176

packages/cli/src/core/filterIgnoredKeys.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ export const DEFAULT_EXCLUDE_KEYS = [
1515
'GITHUB_ACTIONS',
1616
'INIT_CWD',
1717
'TZ',
18+
'PORT',
19+
'PATH',
20+
'HOME',
21+
'USER',
22+
'SHELL',
23+
'LANG',
24+
'TMP',
25+
'TEMP',
26+
'TMPDIR',
27+
'NODE_PATH',
1828
];
1929

2030
/**

packages/cli/test/unit/core/compare/parseAndFilterEnv.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,9 @@ BAZ=
223223
it('handles special characters in values', () => {
224224
fs.writeFileSync(
225225
envPath,
226-
'URL=https://example.com?foo=bar&baz=qux\nPATH=/usr/local/bin\n',
226+
'URL=https://example.com?foo=bar&baz=qux\nDB_PATH=/usr/local/bin\n',
227227
);
228-
fs.writeFileSync(examplePath, 'URL=\nPATH=\n');
228+
fs.writeFileSync(examplePath, 'URL=\nDB_PATH=\n');
229229

230230
const opts: ComparisonOptions = {
231231
checkValues: false,
@@ -237,7 +237,7 @@ BAZ=
237237
const result = parseAndFilterEnv(envPath, examplePath, opts);
238238

239239
expect(result.current.URL).toContain('https://');
240-
expect(result.current.PATH).toBe('/usr/local/bin');
240+
expect(result.current.DB_PATH).toBe('/usr/local/bin');
241241
});
242242

243243
it('handles keys with dots and hyphens', () => {

0 commit comments

Comments
 (0)