Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ini.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const encode = (obj, opt = {}) => {
opt.sort = opt.sort === true
opt.whitespace = opt.whitespace === true || opt.align === true
/* istanbul ignore next */
opt.platform = opt.platform || process?.platform
opt.platform = opt.platform || (typeof process === 'undefined' ? null : process.platform)
opt.bracketedArray = opt.bracketedArray !== false

/* istanbul ignore next */
Expand Down
10 changes: 10 additions & 0 deletions tap-snapshots/test/foo.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -292,3 +292,13 @@ label = debug
value = 10

`

exports[`test/foo.js TAP encode within browser context > must match snapshot 1`] = `
[log]
type=file

[log.level]
label=debug
value=10

`
10 changes: 10 additions & 0 deletions test/foo.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,13 @@ test('encode with align and sort', function (t) {
t.matchSnapshot(e)
t.end()
})

test('encode within browser context', function (t) {
process = undefined

const obj = { log: { type: 'file', level: { label: 'debug', value: 10 } } }
const e = i.encode(obj)

t.matchSnapshot(e)
t.end()
})