Skip to content

Commit

Permalink
demonstrate currently failing (pending) test. multiple env files shou…
Browse files Browse the repository at this point in the history
…ld merge
  • Loading branch information
motdotla committed Jan 24, 2024
1 parent 3e2284b commit 6b829d2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/test-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,27 @@ t.test('takes two or more files in the array for path option', ct => {
ct.end()
})

t.test('sets values from both .env.local and .env. first file key wins.', { skip: true }, ct => {
delete process.env.SINGLE_QUOTES

const testPath = ['tests/.env.local', 'tests/.env']
const env = dotenv.config({ path: testPath })

// in both files - first file wins (.env.local)
ct.equal(env.parsed.BASIC, 'local_basic')
ct.equal(process.env.BASIC, 'local_basic')

// in .env.local only
ct.equal(env.parsed.LOCAL, 'local')
ct.equal(process.env.LOCAL, 'local')

// in .env only
ct.equal(env.parsed.SINGLE_QUOTES, 'single_quotes')
ct.equal(process.env.SINGLE_QUOTES, 'single_quotes')

ct.end()
})

t.test('takes URL for path option', ct => {
const envPath = path.resolve(__dirname, '.env')
const fileUrl = new URL(`file://${envPath}`)
Expand Down

0 comments on commit 6b829d2

Please sign in to comment.