Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update standard to the latest version 🚀 #653

Merged
merged 3 commits into from
Jul 12, 2019
Merged
Show file tree
Hide file tree
Changes from all 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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"prebuildify-ci": "^1.0.4",
"readfiletree": "^1.0.0",
"rimraf": "^2.6.1",
"standard": "^12.0.0",
"standard": "^13.0.1",
"tape": "^4.10.0",
"tempy": "^0.3.0"
},
Expand Down
4 changes: 2 additions & 2 deletions test/compression-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ test('compression', function (t) {
t.error(err)
each(
Array.apply(null, Array(multiples)).map(function (e, i) {
return [ i, compressableData ]
return [i, compressableData]
}), function (args, callback) {
db.put.apply(db, args.concat([callback]))
}, cycle.bind(null, db, true, t, delayed.delayed(verify.bind(null, db.location, true, t), 0.01))
Expand All @@ -64,7 +64,7 @@ test('compression', function (t) {
t.error(err)
each(
Array.apply(null, Array(multiples)).map(function (e, i) {
return [ i, compressableData ]
return [i, compressableData]
}), function (args, callback) {
db.put.apply(db, args.concat([callback]))
}, cycle.bind(null, db, false, t, delayed.delayed(verify.bind(null, db.location, false, t), 0.01))
Expand Down
4 changes: 2 additions & 2 deletions test/destroy-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ test('test destroy non-existent parent directory', function (t) {
test('test destroy non leveldb directory', function (t) {
var tree = {
foo: 'FOO',
bar: { 'one': 'ONE', 'two': 'TWO', 'three': 'THREE' }
bar: { one: 'ONE', two: 'TWO', three: 'THREE' }
}

mkfiletree.makeTemp('destroy-test', tree, function (err, dir) {
Expand Down Expand Up @@ -112,7 +112,7 @@ makeTest('test destroy() cleans and removes only leveldb parts of a dir', functi

readfiletree(location, function (err, tree) {
t.ifError(err, 'no error from readfiletree()')
t.deepEqual(tree, { 'foo': 'FOO' }, 'non-leveldb files left intact')
t.deepEqual(tree, { foo: 'FOO' }, 'non-leveldb files left intact')

done(null, false)
})
Expand Down
2 changes: 1 addition & 1 deletion test/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ app.on('ready', function () {
tape.onFinish(() => app.quit())
tape.onFailure(() => app.exit(1))

for (let file of glob.sync('test/*-test.js')) {
for (const file of glob.sync('test/*-test.js')) {
require(path.resolve('.', file))
}
})
4 changes: 2 additions & 2 deletions test/iterator-recursion-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ test('try to create an iterator with a blown stack', function (t) {
// Reducing the stack size down from the default 984 for the child node
// process makes it easier to trigger the bug condition. But making it too low
// causes the child process to die for other reasons.
var opts = { execArgv: [ '--stack-size=128' ] }
var child = fork(path.join(__dirname, 'stack-blower.js'), [ 'run' ], opts)
var opts = { execArgv: ['--stack-size=128'] }
var child = fork(path.join(__dirname, 'stack-blower.js'), ['run'], opts)

t.plan(2)

Expand Down
30 changes: 11 additions & 19 deletions test/leak-tester-batch.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const assert = require('assert')

let writeCount = 0
let rssBase
let db

function print () {
if (writeCount % 100 === 0) {
Expand All @@ -24,17 +23,14 @@ function print () {
}
}

var run = CHAINED
const run = CHAINED
? function () {
var batch = db.batch()
var i = 0
var key
var value
const batch = db.batch()

for (i = 0; i < 100; i++) {
key = 'long key to test memory usage ' + String(Math.floor(Math.random() * 10000000))
for (let i = 0; i < 100; i++) {
let key = 'long key to test memory usage ' + String(Math.floor(Math.random() * 10000000))
if (BUFFERS) key = Buffer.from(key)
value = crypto.randomBytes(1024)
let value = crypto.randomBytes(1024)
if (!BUFFERS) value = value.toString('hex')
batch.put(key, value)
}
Expand All @@ -45,19 +41,15 @@ var run = CHAINED
})

writeCount++

print()
}
: function () {
var batch = []
var i
var key
var value
const batch = []

for (i = 0; i < 100; i++) {
key = 'long key to test memory usage ' + String(Math.floor(Math.random() * 10000000))
for (let i = 0; i < 100; i++) {
let key = 'long key to test memory usage ' + String(Math.floor(Math.random() * 10000000))
if (BUFFERS) key = Buffer.from(key)
value = crypto.randomBytes(1024)
let value = crypto.randomBytes(1024)
if (!BUFFERS) value = value.toString('hex')
batch.push({ type: 'put', key: key, value: value })
}
Expand All @@ -68,11 +60,11 @@ var run = CHAINED
})

writeCount++

print()
}

db = testCommon.factory()
const db = testCommon.factory()

db.open(function () {
rssBase = process.memoryUsage().rss
run()
Expand Down
8 changes: 4 additions & 4 deletions test/leak-tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@ const crypto = require('crypto')
let putCount = 0
let getCount = 0
let rssBase
let db

function run () {
var key = 'long key to test memory usage ' + String(Math.floor(Math.random() * 10000000))
let key = 'long key to test memory usage ' + String(Math.floor(Math.random() * 10000000))

if (BUFFERS) key = Buffer.from(key)

db.get(key, function (err, value) {
getCount++

if (err) {
var putValue = crypto.randomBytes(1024)
let putValue = crypto.randomBytes(1024)
if (!BUFFERS) putValue = putValue.toString('hex')

return db.put(key, putValue, function () {
Expand All @@ -40,7 +39,8 @@ function run () {
}
}

db = testCommon.factory()
const db = testCommon.factory()

db.open(function () {
rssBase = process.memoryUsage().rss
run()
Expand Down
2 changes: 1 addition & 1 deletion test/segfault-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ testPending('compactRange()', 1, function (db, next) {

// Test multiple pending operations, using all of the above.
testPending('operations', operations.length, function (db, next) {
for (let fn of operations.slice(0, -1)) {
for (const fn of operations.slice(0, -1)) {
fn(db, next)
}
})
Expand Down