Skip to content

Commit 6b829d2

Browse files
committed
demonstrate currently failing (pending) test. multiple env files should merge
1 parent 3e2284b commit 6b829d2

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/test-config.js

+21
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,27 @@ t.test('takes two or more files in the array for path option', ct => {
4141
ct.end()
4242
})
4343

44+
t.test('sets values from both .env.local and .env. first file key wins.', { skip: true }, ct => {
45+
delete process.env.SINGLE_QUOTES
46+
47+
const testPath = ['tests/.env.local', 'tests/.env']
48+
const env = dotenv.config({ path: testPath })
49+
50+
// in both files - first file wins (.env.local)
51+
ct.equal(env.parsed.BASIC, 'local_basic')
52+
ct.equal(process.env.BASIC, 'local_basic')
53+
54+
// in .env.local only
55+
ct.equal(env.parsed.LOCAL, 'local')
56+
ct.equal(process.env.LOCAL, 'local')
57+
58+
// in .env only
59+
ct.equal(env.parsed.SINGLE_QUOTES, 'single_quotes')
60+
ct.equal(process.env.SINGLE_QUOTES, 'single_quotes')
61+
62+
ct.end()
63+
})
64+
4465
t.test('takes URL for path option', ct => {
4566
const envPath = path.resolve(__dirname, '.env')
4667
const fileUrl = new URL(`file://${envPath}`)

0 commit comments

Comments
 (0)