Skip to content

Commit

Permalink
Update tests to reflect quieter debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
motdotla committed Jan 16, 2022
1 parent 4da6250 commit 3b5eac5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/test-parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const dotenv = require('../lib/main')

const parsed = dotenv.parse(fs.readFileSync('tests/.env', { encoding: 'utf8' }))

t.plan(28)
t.plan(29)

t.type(parsed, Object, 'should return an object')

Expand Down Expand Up @@ -73,8 +73,14 @@ dotenv.parse(Buffer.from('what is this'), { debug: true })
t.ok(logStub.calledOnce)
logStub.restore()

// test that debug in windows (\r\n lines) logs just once per line
// test that debug in windows (\r\n lines) logs never
logStub = sinon.stub(console, 'log')
dotenv.parse(Buffer.from('HEY=there\r\n'), { debug: true })
t.ok(logStub.calledOnce)
t.equal(logStub.called, false)
logStub.restore()

// test that debug in windows (\r\n lines) logs when a repeated key
logStub = sinon.stub(console, 'log')
dotenv.parse(Buffer.from('what is this\r\n'), { debug: true })
t.equal(logStub.called, true)
logStub.restore()

0 comments on commit 3b5eac5

Please sign in to comment.