Skip to content

Commit 5b6e89b

Browse files
authored
Ignore .env.local in test environment (facebook#2250)
1 parent 76f50aa commit 5b6e89b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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)