diff --git a/package.json b/package.json index e2d02805..f85e77fd 100644 --- a/package.json +++ b/package.json @@ -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" }, diff --git a/test/compression-test.js b/test/compression-test.js index bf301bf3..63c715da 100644 --- a/test/compression-test.js +++ b/test/compression-test.js @@ -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)) @@ -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)) diff --git a/test/destroy-test.js b/test/destroy-test.js index 32dfa976..68029f48 100644 --- a/test/destroy-test.js +++ b/test/destroy-test.js @@ -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) { @@ -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) }) diff --git a/test/electron.js b/test/electron.js index 086c5a94..4ab95904 100644 --- a/test/electron.js +++ b/test/electron.js @@ -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)) } }) diff --git a/test/iterator-recursion-test.js b/test/iterator-recursion-test.js index 1c799fd2..15249b73 100644 --- a/test/iterator-recursion-test.js +++ b/test/iterator-recursion-test.js @@ -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) diff --git a/test/leak-tester-batch.js b/test/leak-tester-batch.js index 5130ffe7..f52f7676 100644 --- a/test/leak-tester-batch.js +++ b/test/leak-tester-batch.js @@ -7,7 +7,6 @@ const assert = require('assert') let writeCount = 0 let rssBase -let db function print () { if (writeCount % 100 === 0) { @@ -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) } @@ -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 }) } @@ -68,11 +60,11 @@ var run = CHAINED }) writeCount++ - print() } -db = testCommon.factory() +const db = testCommon.factory() + db.open(function () { rssBase = process.memoryUsage().rss run() diff --git a/test/leak-tester.js b/test/leak-tester.js index 6419bf6b..15b95dba 100644 --- a/test/leak-tester.js +++ b/test/leak-tester.js @@ -6,10 +6,9 @@ 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) @@ -17,7 +16,7 @@ function run () { 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 () { @@ -40,7 +39,8 @@ function run () { } } -db = testCommon.factory() +const db = testCommon.factory() + db.open(function () { rssBase = process.memoryUsage().rss run() diff --git a/test/segfault-test.js b/test/segfault-test.js index e7941520..c5982cf5 100644 --- a/test/segfault-test.js +++ b/test/segfault-test.js @@ -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) } })