Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
chore: remove usage of unnecessary util.promisify
This is safe to do now that we've dropped node 10 support.

PR-URL: #3988
Credit: @lukekarrys
Close: #3988
Reviewed-by: @wraithgar
  • Loading branch information
lukekarrys authored and wraithgar committed Nov 4, 2021
1 parent c640957 commit 32ccd3c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
4 changes: 1 addition & 3 deletions lib/utils/reify-finish.js
@@ -1,8 +1,6 @@
const reifyOutput = require('./reify-output.js')
const ini = require('ini')
const util = require('util')
const fs = require('fs')
const { writeFile } = fs.promises || { writeFile: util.promisify(fs.writeFile) }
const { writeFile } = require('fs').promises
const {resolve} = require('path')

const reifyFinish = async (npm, arb) => {
Expand Down
8 changes: 0 additions & 8 deletions test/lib/utils/reify-finish.js
Expand Up @@ -76,11 +76,3 @@ t.test('should write if everything above passes', async t => {
const data = fs.readFileSync(`${path}/npmrc`, 'utf8').replace(/\r\n/g, '\n')
t.matchSnapshot(data, 'written config')
})

t.test('works without fs.promises', async t => {
t.doesNotThrow(() => t.mock('../../../lib/utils/reify-finish.js', {
fs: { ...fs, promises: null },
'../../../lib/npm.js': npm,
'../../../lib/utils/reify-output.js': reifyOutput,
}))
})

0 comments on commit 32ccd3c

Please sign in to comment.