Skip to content

Commit

Permalink
fixup! fix: prefer fs/promises over promisify
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Apr 22, 2024
1 parent 50ea2fd commit d8624ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 42 deletions.
39 changes: 0 additions & 39 deletions workspaces/libnpmversion/tap-snapshots/test/write-json.js.test.cjs

This file was deleted.

9 changes: 6 additions & 3 deletions workspaces/libnpmversion/test/write-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ t.test('write json with newlines and indent set', async t => {
b: [2, 3],
})

await t.resolveMatchSnapshot(readFile(file, 'utf-8'))
const str = await readFile(file, 'utf-8')
t.equal(str, `{\r\n "a": 1,\r\n "b": [\r\n 2,\r\n 3\r\n ]\r\n}\r\n`)
})

t.test('string tap indent, CRLF line breaks', async t => {
Expand All @@ -32,7 +33,8 @@ t.test('write json with newlines and indent set', async t => {
b: [2, 3],
})

await t.resolveMatchSnapshot(readFile(file, 'utf-8'))
const str = await readFile(file, 'utf-8')
t.equal(str, `{XYZ\n\t"a": 1,XYZ\n\t"b": [XYZ\n\t\t2,XYZ\n\t\t3XYZ\n\t]XYZ\n}XYZ\n`)
})

t.test('default newline and indent', async t => {
Expand All @@ -44,7 +46,8 @@ t.test('write json with newlines and indent set', async t => {
b: [2, 3],
})

await t.resolveMatchSnapshot(readFile(file, 'utf-8'))
const str = await readFile(file, 'utf-8')
t.match(str, `{\n "a": 1,\n "b": [\n 2,\n 3\n ]\n}\n`)
})

t.end()
Expand Down

0 comments on commit d8624ed

Please sign in to comment.