Skip to content

Commit f3f5599

Browse files
authored
Ignore .env.local in test environment (#2250)
1 parent 1834cb5 commit f3f5599

File tree

1 file changed

+6
-2
lines changed
  • packages/react-scripts/config

1 file changed

+6
-2
lines changed

packages/react-scripts/config/env.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@ if (!NODE_ENV) {
2727
var dotenvFiles = [
2828
`${paths.dotenv}.${NODE_ENV}.local`,
2929
`${paths.dotenv}.${NODE_ENV}`,
30-
`${paths.dotenv}.local`,
30+
// Don't include `.env.local` for `test` environment
31+
// since normally you expect tests to produce the same
32+
// results for everyone
33+
NODE_ENV !== 'test' && `${paths.dotenv}.local`,
3134
paths.dotenv,
32-
];
35+
].filter(Boolean);
36+
3337
// Load environment variables from .env* files. Suppress warnings using silent
3438
// if this file is missing. dotenv will never modify any environment variables
3539
// that have already been set.

0 commit comments

Comments
 (0)