From 012d3a90323050657d6e217323054bacddc0d018 Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Sun, 25 Apr 2021 20:03:20 +0200 Subject: [PATCH] Breaking: modernize syntax (Level/community#98) --- .airtap.yml | 7 +++++++ .github/dependabot.yml | 4 ---- index.js | 16 ++++++++-------- location-browser.js | 2 +- package.json | 9 +++++---- test/browser.js | 12 ++++++------ test/node.js | 14 +++++++------- test/suite.js | 28 ++++++++++++++-------------- 8 files changed, 48 insertions(+), 44 deletions(-) create mode 100644 .airtap.yml diff --git a/.airtap.yml b/.airtap.yml new file mode 100644 index 0000000..225fb41 --- /dev/null +++ b/.airtap.yml @@ -0,0 +1,7 @@ +providers: + - airtap-playwright + +browsers: + - name: chromium + - name: firefox + - name: webkit diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 27027aa..35c4756 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,7 +6,3 @@ updates: interval: monthly ignore: - dependency-name: dependency-check - - dependency-name: uuid - - dependency-name: tempy - - dependency-name: airtap - - dependency-name: standard diff --git a/index.js b/index.js index e437714..b54baf7 100644 --- a/index.js +++ b/index.js @@ -1,11 +1,11 @@ 'use strict' -var compose = require('level-compose') -var leveldown = require('leveldown') -var memdown = require('memdown') -var encode = require('encoding-down') -var levelup = require('levelup') -var getLocation = require('./location') +const compose = require('level-compose') +const leveldown = require('leveldown') +const memdown = require('memdown') +const encode = require('encoding-down') +const levelup = require('levelup') +const getLocation = require('./location') module.exports = function factory (down, defaults) { if (typeof down !== 'function') { @@ -17,8 +17,8 @@ module.exports = function factory (down, defaults) { down = down || (defaults.mem ? memdown : leveldown) // The layers option is experimental and undocumented. Use at your own risk. - var layers = defaults.layers || [encode, levelup] - var shell = compose([locationFallback, down, layers], defaults) + const layers = defaults.layers || [encode, levelup] + const shell = compose([locationFallback, down, layers], defaults) return shell } diff --git a/location-browser.js b/location-browser.js index 88b49f8..2ef6396 100644 --- a/location-browser.js +++ b/location-browser.js @@ -1,3 +1,3 @@ 'use strict' -module.exports = require('uuid/v4') +module.exports = require('uuid').v4 diff --git a/package.json b/package.json index b230e66..7a9eac3 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "scripts": { "test": "standard && hallmark && (nyc -s node test/node.js | faucet) && nyc report", "coverage": "nyc report -r lcovonly", - "test-browser-local": "airtap --local test/browser.js", + "test-browsers-local": "airtap test/browser.js", "hallmark": "hallmark --fix", "dependency-check": "dependency-check . browser.js test/*.js", "prepublishOnly": "npm run dependency-check" @@ -22,12 +22,13 @@ "level-js": "^5.0.0", "levelup": "^4.3.1", "memdown": "^5.1.0", - "tempy": "^0.3.0", + "tempy": "^1.0.1", "uuid": "^3.3.2" }, "devDependencies": { "abstract-leveldown": "^6.0.0", - "airtap": "^3.0.0", + "airtap": "^4.0.3", + "airtap-playwright": "^1.0.1", "dependency-check": "^3.3.0", "faucet": "^0.0.1", "hallmark": "^3.1.0", @@ -36,7 +37,7 @@ "level-packager": "^5.0.3", "nyc": "^15.0.0", "reachdown": "^1.0.0", - "standard": "^14.0.0", + "standard": "^16.0.3", "tape": "^5.0.1" }, "optionalDependencies": { diff --git a/test/browser.js b/test/browser.js index fed86d5..d7cfdd5 100644 --- a/test/browser.js +++ b/test/browser.js @@ -1,11 +1,11 @@ 'use strict' -var leveljs = require('level-js') -var memdown = require('memdown') -var encode = require('encoding-down') -var levelup = require('levelup') -var levelTest = require('../') -var suite = require('./suite') +const leveljs = require('level-js') +const memdown = require('memdown') +const encode = require('encoding-down') +const levelup = require('levelup') +const levelTest = require('../') +const suite = require('./suite') suite.args(levelTest(), leveljs) suite.args(levelTest({ mem: true }), memdown) diff --git a/test/node.js b/test/node.js index 6bfdba1..cb60493 100644 --- a/test/node.js +++ b/test/node.js @@ -1,12 +1,12 @@ 'use strict' -var leveldown = require('leveldown') -var memdown = require('memdown') -var jsondown = require('jsondown') -var encode = require('encoding-down') -var levelup = require('levelup') -var levelTest = require('../') -var suite = require('./suite') +const leveldown = require('leveldown') +const memdown = require('memdown') +const jsondown = require('jsondown') +const encode = require('encoding-down') +const levelup = require('levelup') +const levelTest = require('../') +const suite = require('./suite') suite.args(levelTest(), leveldown) suite.args(levelTest({ mem: true }), memdown) diff --git a/test/suite.js b/test/suite.js index 58d7f4f..a59f640 100644 --- a/test/suite.js +++ b/test/suite.js @@ -1,14 +1,14 @@ 'use strict' -var test = require('tape') -var reachdown = require('reachdown') -var packagerTests = require('level-packager/abstract/test') +const test = require('tape') +const reachdown = require('reachdown') +const packagerTests = require('level-packager/abstract/test') exports.args = function (level, expectedDown) { test('without arguments', function (t) { t.plan(3) - var db = level() + const db = level() db.on('open', function () { t.ok(reachdown(db) instanceof expectedDown, 'got expected down') @@ -28,8 +28,8 @@ exports.args = function (level, expectedDown) { t.ok(db.isOpen()) t.ok(reachdown(db) instanceof expectedDown, 'got expected down') - var key = '' + Math.random() - var value = { test_key: '' + new Date() } + const key = '' + Math.random() + const value = { test_key: '' + new Date() } db.put(key, value, function (err) { t.notOk(err) @@ -45,9 +45,9 @@ exports.args = function (level, expectedDown) { test('with options', function (t) { t.plan(4) - var db = level({ valueEncoding: 'json' }) - var key = '' + Math.random() - var value = { test_key: '' + new Date() } + const db = level({ valueEncoding: 'json' }) + const key = '' + Math.random() + const value = { test_key: '' + new Date() } db.on('open', function () { t.ok(reachdown(db) instanceof expectedDown, 'got expected down') @@ -87,7 +87,7 @@ exports.customLayers = function (level, expectedDown, expectedUp, rawValue) { test('custom layers with auto-open', function (t) { t.plan(9) - var ret = level(function (err, db) { + const ret = level(function (err, db) { t.ifError(err) t.is(db, ret, 'got db') t.ok(reachdown(db) instanceof expectedDown, 'got expected down') @@ -114,10 +114,10 @@ exports.options = function (levelTest) { test('opts precedence', function (t) { t.plan(6) - var level = levelTest({ valueEncoding: 'utf8' }) - var db1 = level() - var db2 = level({ valueEncoding: 'json' }) - var value = { test: true } + const level = levelTest({ valueEncoding: 'utf8' }) + const db1 = level() + const db2 = level({ valueEncoding: 'json' }) + const value = { test: true } db1.put('key', value, function (err) { t.ifError(err)