Skip to content

Commit

Permalink
Upgrade to standard v12 (#685)
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanZim committed May 14, 2019
1 parent fa661f3 commit f3a2eed
Show file tree
Hide file tree
Showing 19 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion lib/__tests__/promise.test.js
Expand Up @@ -29,7 +29,7 @@ describe('promise support', () => {
it('provides fse.promises API', () => {
const desc = Object.getOwnPropertyDescriptor(fse, 'promises')
assert.ok(desc)
assert.equal(typeof desc.get, 'function')
assert.strictEqual(typeof desc.get, 'function')
})
}
})
2 changes: 1 addition & 1 deletion lib/copy-sync/__tests__/broken-symlink.test.js
Expand Up @@ -28,7 +28,7 @@ describe('copy-sync / broken symlink', () => {
})

it('should throw an error when dereference=true', () => {
assert.throws(() => copySync(src, out, {dereference: true}), err => err.code === 'ENOENT')
assert.throws(() => copySync(src, out, { dereference: true }), err => err.code === 'ENOENT')
})
})

Expand Down
14 changes: 7 additions & 7 deletions lib/copy-sync/__tests__/copy-sync-file.test.js
Expand Up @@ -136,15 +136,15 @@ describe('+ copySync() / file', () => {
describe('> when destination file does NOT exist', () => {
describe('> when overwrite is true', () => {
it('should copy the file and not throw an error', () => {
fs.copySync(src, dest, {overwrite: true})
fs.copySync(src, dest, { overwrite: true })
const destData = fs.readFileSync(dest, 'utf8')
assert.strictEqual(srcData, destData)
})
})

describe('> when overwrite is false', () => {
it('should copy the file and not throw an error', () => {
fs.copySync(src, dest, {overwrite: false})
fs.copySync(src, dest, { overwrite: false })
const destData = fs.readFileSync(dest, 'utf8')
assert.strictEqual(srcData, destData)
})
Expand All @@ -161,22 +161,22 @@ describe('+ copySync() / file', () => {

describe('> when overwrite is true', () => {
it('should copy the file and not throw an error', () => {
fs.copySync(src, dest, {overwrite: true})
fs.copySync(src, dest, { overwrite: true })
destData = fs.readFileSync(dest, 'utf8')
assert.strictEqual(srcData, destData)
})
})

describe('> when overwrite is false', () => {
it('should not throw an error', () => {
fs.copySync(src, dest, {overwrite: false})
fs.copySync(src, dest, { overwrite: false })

// copy never happened
const destDataNew = fs.readFileSync(dest, 'utf8')
assert.strictEqual(destData, destDataNew)
})
it('should throw an error when errorOnExist is true', () => {
assert.throws(() => fs.copySync(src, dest, {overwrite: false, errorOnExist: true}))
assert.throws(() => fs.copySync(src, dest, { overwrite: false, errorOnExist: true }))

// copy never happened
const destDataNew = fs.readFileSync(dest, 'utf8')
Expand All @@ -188,7 +188,7 @@ describe('+ copySync() / file', () => {
it('should copy the file and not throw an error', () => {
try {
fs.chmodSync(dest, parseInt('444', 8))
fs.copySync(src, dest, {overwrite: true})
fs.copySync(src, dest, { overwrite: true })
destData = fs.readFileSync(dest, 'utf8')
assert.strictEqual(srcData, destData)
} finally {
Expand All @@ -212,7 +212,7 @@ describe('+ copySync() / file', () => {
})

it('is an alias for overwrite', () => {
fs.copySync(src, dest, {clobber: false})
fs.copySync(src, dest, { clobber: false })

// copy never happened
const destDataNew = fs.readFileSync(dest, 'utf8')
Expand Down
4 changes: 2 additions & 2 deletions lib/copy-sync/__tests__/copy-sync-preserve-timestamp.test.js
Expand Up @@ -32,8 +32,8 @@ describeIfPractical('copySync() - preserveTimestamps option', () => {

describe('> when preserveTimestamps option is true', () => {
it('should have the same timestamps on copy', () => {
fs.copySync(SRC, DEST, {preserveTimestamps: true})
FILES.forEach(testFile({preserveTimestamps: true}))
fs.copySync(SRC, DEST, { preserveTimestamps: true })
FILES.forEach(testFile({ preserveTimestamps: true }))
})
})

Expand Down
2 changes: 1 addition & 1 deletion lib/copy-sync/__tests__/symlink.test.js
Expand Up @@ -35,7 +35,7 @@ describe('copy-sync / symlink', () => {

it('copies file contents when dereference=true', () => {
try {
copySync(src, out, {dereference: true})
copySync(src, out, { dereference: true })
} catch (err) {
assert.ifError(err)
}
Expand Down
2 changes: 1 addition & 1 deletion lib/copy-sync/copy-sync.js
Expand Up @@ -10,7 +10,7 @@ const stat = require('../util/stat')

function copySync (src, dest, opts) {
if (typeof opts === 'function') {
opts = {filter: opts}
opts = { filter: opts }
}

opts = opts || {}
Expand Down
4 changes: 2 additions & 2 deletions lib/copy/__tests__/copy-preserve-timestamp.test.js
Expand Up @@ -33,8 +33,8 @@ describeIfPractical('copy() - preserve timestamp', () => {

describe('> when timestamp option is true', () => {
it('should have the same timestamps on copy', done => {
copy(SRC, DEST, {preserveTimestamps: true}, () => {
FILES.forEach(testFile({preserveTimestamps: true}))
copy(SRC, DEST, { preserveTimestamps: true }, () => {
FILES.forEach(testFile({ preserveTimestamps: true }))
done()
})
})
Expand Down
4 changes: 2 additions & 2 deletions lib/copy/__tests__/copy.test.js
Expand Up @@ -38,7 +38,7 @@ describe('fs-extra', () => {

fse.ensureFileSync(src)
fse.ensureFileSync(dest)
fse.copy(src, dest, {overwrite: false, errorOnExist: true}, err => {
fse.copy(src, dest, { overwrite: false, errorOnExist: true }, err => {
assert(err)
done()
})
Expand All @@ -50,7 +50,7 @@ describe('fs-extra', () => {

fse.ensureFileSync(src)
fse.ensureFileSync(dest)
fse.copy(src, dest, {overwrite: false, errorOnExist: true}, err => {
fse.copy(src, dest, { overwrite: false, errorOnExist: true }, err => {
assert(err)
done()
})
Expand Down
2 changes: 1 addition & 1 deletion lib/copy/__tests__/ncp/broken-symlink.test.js
Expand Up @@ -31,7 +31,7 @@ describe('ncp broken symlink', () => {
})

it('should return an error when dereference=true', done => {
ncp(src, out, {dereference: true}, err => {
ncp(src, out, { dereference: true }, err => {
assert.strictEqual(err.code, 'ENOENT')
done()
})
Expand Down
6 changes: 3 additions & 3 deletions lib/copy/__tests__/ncp/ncp.test.js
Expand Up @@ -72,7 +72,7 @@ describe('ncp', () => {
})

it('the copy is complete after callback', done => {
ncp(src, out, {overwrite: true}, err => {
ncp(src, out, { overwrite: true }, err => {
fs.createReadStream = () => done(new Error('createReadStream after callback'))

assert.ifError(err)
Expand All @@ -85,15 +85,15 @@ describe('ncp', () => {
beforeEach(done => rimraf(out, done))

it('works', cb => {
ncp(src, out, {overwrite: false}, err => {
ncp(src, out, { overwrite: false }, err => {
assert.ifError(err)
cb()
})
})

it('should not error if files exist', cb => {
ncp(src, out, () => {
ncp(src, out, {overwrite: false}, err => {
ncp(src, out, { overwrite: false }, err => {
assert.ifError(err)
cb()
})
Expand Down
2 changes: 1 addition & 1 deletion lib/copy/__tests__/ncp/symlink.test.js
Expand Up @@ -35,7 +35,7 @@ describe('ncp / symlink', () => {
})

it('copies file contents when dereference=true', done => {
ncp(src, out, {dereference: true}, err => {
ncp(src, out, { dereference: true }, err => {
assert.ifError(err)

const fileSymlinkPath = path.join(out, 'file-symlink')
Expand Down
2 changes: 1 addition & 1 deletion lib/copy/copy.js
Expand Up @@ -14,7 +14,7 @@ function copy (src, dest, opts, cb) {
cb = opts
opts = {}
} else if (typeof opts === 'function') {
opts = {filter: opts}
opts = { filter: opts }
}

cb = cb || function () {}
Expand Down
14 changes: 7 additions & 7 deletions lib/ensure/__tests__/symlink-paths.test.js
Expand Up @@ -38,16 +38,16 @@ describe('symlink-type', () => {
})

const tests = [
[['foo.txt', 'symlink.txt'], {toCwd: 'foo.txt', toDst: 'foo.txt'}], // smart && nodestyle
[['foo.txt', 'empty-dir/symlink.txt'], {toCwd: 'foo.txt', toDst: '../foo.txt'}], // smart
[['../foo.txt', 'empty-dir/symlink.txt'], {toCwd: 'foo.txt', toDst: '../foo.txt'}], // nodestyle
[['foo.txt', 'dir-bar/symlink.txt'], {toCwd: 'foo.txt', toDst: '../foo.txt'}], // smart
[['../foo.txt', 'dir-bar/symlink.txt'], {toCwd: 'foo.txt', toDst: '../foo.txt'}], // nodestyle
[['foo.txt', 'symlink.txt'], { toCwd: 'foo.txt', toDst: 'foo.txt' }], // smart && nodestyle
[['foo.txt', 'empty-dir/symlink.txt'], { toCwd: 'foo.txt', toDst: '../foo.txt' }], // smart
[['../foo.txt', 'empty-dir/symlink.txt'], { toCwd: 'foo.txt', toDst: '../foo.txt' }], // nodestyle
[['foo.txt', 'dir-bar/symlink.txt'], { toCwd: 'foo.txt', toDst: '../foo.txt' }], // smart
[['../foo.txt', 'dir-bar/symlink.txt'], { toCwd: 'foo.txt', toDst: '../foo.txt' }], // nodestyle
// this is to preserve node's symlink capability these arguments say create
// a link to 'dir-foo/foo.txt' this works because it exists this is unlike
// the previous example with 'empty-dir' because 'empty-dir/foo.txt' does not exist.
[['foo.txt', 'dir-foo/symlink.txt'], {toCwd: 'dir-foo/foo.txt', toDst: 'foo.txt'}], // nodestyle
[['foo.txt', 'real-alpha/real-beta/real-gamma/symlink.txt'], {toCwd: 'foo.txt', toDst: '../../../foo.txt'}]
[['foo.txt', 'dir-foo/symlink.txt'], { toCwd: 'dir-foo/foo.txt', toDst: 'foo.txt' }], // nodestyle
[['foo.txt', 'real-alpha/real-beta/real-gamma/symlink.txt'], { toCwd: 'foo.txt', toDst: '../../../foo.txt' }]
]

// formats paths to pass on multiple operating systems
Expand Down
4 changes: 2 additions & 2 deletions lib/json/__tests__/output-json-sync.test.js
Expand Up @@ -22,7 +22,7 @@ describe('json', () => {
const file = path.join(TEST_DIR, 'this-dir', 'does-not', 'exist', 'file.json')
assert(!fs.existsSync(file))

const data = {name: 'JP'}
const data = { name: 'JP' }
outputJsonSync(file, data)

assert(fs.existsSync(file))
Expand All @@ -37,7 +37,7 @@ describe('json', () => {
assert(!fs.existsSync(file))

const replacer = (k, v) => v === 'JP' ? 'Jon Paul' : v
const data = {name: 'JP'}
const data = { name: 'JP' }

outputJsonSync(file, data, { replacer })
const newData = JSON.parse(fs.readFileSync(file, 'utf8'))
Expand Down
6 changes: 3 additions & 3 deletions lib/json/__tests__/output-json.test.js
Expand Up @@ -22,7 +22,7 @@ describe('json', () => {
const file = path.join(TEST_DIR, 'this-dir', 'prob-does-not', 'exist', 'file.json')
assert(!fs.existsSync(file))

const data = {name: 'JP'}
const data = { name: 'JP' }
outputJson(file, data, err => {
if (err) return done(err)

Expand All @@ -38,7 +38,7 @@ describe('json', () => {
const file = path.join(TEST_DIR, 'this-dir', 'prob-does-not', 'exist', 'file.json')
assert(!fs.existsSync(file))

const data = {name: 'JP'}
const data = { name: 'JP' }
return outputJson(file, data)
})

Expand All @@ -48,7 +48,7 @@ describe('json', () => {
assert(!fs.existsSync(file))

const replacer = (k, v) => v === 'JP' ? 'Jon Paul' : v
const data = {name: 'JP'}
const data = { name: 'JP' }

outputJson(file, data, { replacer }, err => {
assert.ifError(err)
Expand Down
10 changes: 5 additions & 5 deletions lib/move-sync/__tests__/move-sync.test.js
Expand Up @@ -103,7 +103,7 @@ describe('moveSync()', () => {
assert(fs.existsSync(dest))

try {
fse.moveSync(src, dest, {overwrite: false})
fse.moveSync(src, dest, { overwrite: false })
} catch (err) {
assert.strictEqual(err.message, 'dest already exists.')
}
Expand All @@ -116,7 +116,7 @@ describe('moveSync()', () => {
// verify file exists already
assert(fs.existsSync(dest))

fse.moveSync(src, dest, {overwrite: true})
fse.moveSync(src, dest, { overwrite: true })

const contents = fs.readFileSync(dest, 'utf8')
const expected = /^sonic the hedgehog\r?\n$/
Expand All @@ -137,7 +137,7 @@ describe('moveSync()', () => {
assert(pathsBefore.indexOf('another-file') >= 0)
assert(pathsBefore.indexOf('another-folder') >= 0)

fse.moveSync(src, dest, {overwrite: true})
fse.moveSync(src, dest, { overwrite: true })

// verify dest does not have old stuff
const pathsAfter = fs.readdirSync(dest)
Expand Down Expand Up @@ -198,7 +198,7 @@ describe('moveSync()', () => {

setUpMockFs('EXDEV')

fse.moveSync(src, dest, {overwrite: true})
fse.moveSync(src, dest, { overwrite: true })

const contents = fs.readFileSync(dest + '/another-folder/file3', 'utf8')
const expected = /^knuckles\r?\n$/
Expand Down Expand Up @@ -228,7 +228,7 @@ describe('moveSync()', () => {
// verify file exists already
assert(fs.existsSync(dest))

fse.moveSync(src, dest, {clobber: true})
fse.moveSync(src, dest, { clobber: true })

const contents = fs.readFileSync(dest, 'utf8')
const expected = /^sonic the hedgehog\r?\n$/
Expand Down
10 changes: 5 additions & 5 deletions lib/move/__tests__/move.test.js
Expand Up @@ -60,7 +60,7 @@ describe('+ move()', () => {
// verify file exists already
assert(fs.existsSync(dest))

fse.move(src, dest, {overwrite: true}, err => {
fse.move(src, dest, { overwrite: true }, err => {
assert.ifError(err)
fs.readFile(dest, 'utf8', (err, contents) => {
const expected = /^sonic the hedgehog\r?\n$/
Expand All @@ -85,7 +85,7 @@ describe('+ move()', () => {
assert(paths.indexOf('another-file') >= 0)
assert(paths.indexOf('another-folder') >= 0)

fse.move(src, dest, {overwrite: true}, err => {
fse.move(src, dest, { overwrite: true }, err => {
assert.ifError(err)

// verify dest does not have old stuff
Expand All @@ -109,7 +109,7 @@ describe('+ move()', () => {

setUpMockFs('EXDEV')

fse.move(src, dest, {overwrite: true}, err => {
fse.move(src, dest, { overwrite: true }, err => {
assert.ifError(err)
assert.strictEqual(fs.rename.callCount, 1)

Expand Down Expand Up @@ -190,7 +190,7 @@ describe('+ move()', () => {
// verify file exists already
assert(fs.existsSync(dest))

fse.move(src, dest, {overwrite: false}, err => {
fse.move(src, dest, { overwrite: false }, err => {
assert.strictEqual(err.message, 'dest already exists.')
done()
})
Expand Down Expand Up @@ -281,7 +281,7 @@ describe('+ move()', () => {
// verify file exists already
assert(fs.existsSync(dest))

fse.move(src, dest, {clobber: true}, err => {
fse.move(src, dest, { clobber: true }, err => {
assert.ifError(err)
fs.readFile(dest, 'utf8', (err, contents) => {
const expected = /^sonic the hedgehog\r?\n$/
Expand Down
2 changes: 1 addition & 1 deletion lib/util/__tests__/utimes.test.js
Expand Up @@ -19,7 +19,7 @@ describe('utimes', () => {
fse.emptyDir(TEST_DIR, done)
// reset stubs
gracefulFsStub = {}
utimes = proxyquire('../utimes', {'graceful-fs': gracefulFsStub})
utimes = proxyquire('../utimes', { 'graceful-fs': gracefulFsStub })
})

describe('hasMillisResSync()', () => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -50,7 +50,7 @@
"proxyquire": "^2.0.1",
"read-dir-files": "^0.1.1",
"semver": "^5.3.0",
"standard": "^11.0.1"
"standard": "^12.0.1"
},
"main": "./lib/index.js",
"scripts": {
Expand Down

0 comments on commit f3a2eed

Please sign in to comment.