From 5cff3320d2213c504695f694d7b742df3f5e11c9 Mon Sep 17 00:00:00 2001 From: leibale Date: Mon, 1 Nov 2021 11:30:25 -0400 Subject: [PATCH] use dockers for tests, fix some bugs --- .eslintrc.json | 5 +- .github/workflows/tests.yml | 10 +- .nycrc.json | 2 +- README.md | 2 +- docs/clustering.md | 2 +- lib/client/commands-queue.ts | 8 +- lib/client/index.spec.ts | 488 +++++----- lib/client/index.ts | 26 +- lib/client/socket.spec.ts | 2 +- lib/client/socket.ts | 73 +- lib/cluster/index.spec.ts | 57 +- lib/commands/ACL_CAT.spec.ts | 4 +- lib/commands/ACL_DELUSER.spec.ts | 8 +- lib/commands/ACL_GENPASS.spec.ts | 4 +- lib/commands/ACL_GETUSER.spec.ts | 10 +- lib/commands/ACL_LIST.spec.ts | 4 +- lib/commands/ACL_LOAD.spec.ts | 4 +- lib/commands/ACL_LOG.spec.ts | 4 +- lib/commands/ACL_LOG_RESET.spec.ts | 4 +- lib/commands/ACL_SAVE.spec.ts | 4 +- lib/commands/ACL_SETUSER.spec.ts | 4 +- lib/commands/ACL_USERS.spec.ts | 4 +- lib/commands/ACL_WHOAMI.spec.ts | 4 +- lib/commands/APPEND.spec.ts | 2 +- lib/commands/BITCOUNT.spec.ts | 6 +- lib/commands/BITFIELD.spec.ts | 6 +- lib/commands/BITOP.spec.ts | 10 +- lib/commands/BITPOS.spec.ts | 10 +- lib/commands/BLMOVE.spec.ts | 12 +- lib/commands/BLPOP.spec.ts | 10 +- lib/commands/BRPOP.spec.ts | 10 +- lib/commands/BRPOPLPUSH.spec.ts | 10 +- lib/commands/BZPOPMAX.spec.ts | 6 +- lib/commands/BZPOPMIN.spec.ts | 6 +- lib/commands/CLIENT_ID.spec.ts | 6 +- lib/commands/CLUSTER_SLOTS.spec.ts | 2 +- lib/commands/COMMAND.spec.ts | 23 +- lib/commands/COMMAND_COUNT.spec.ts | 6 +- lib/commands/COMMAND_GETKEYS.spec.ts | 6 +- lib/commands/COMMAND_INFO.spec.ts | 42 +- lib/commands/COPY.spec.ts | 8 +- lib/commands/DBSIZE.spec.ts | 6 +- lib/commands/DECR.spec.ts | 6 +- lib/commands/DECRBY.spec.ts | 6 +- lib/commands/DEL.spec.ts | 6 +- lib/commands/DUMP.spec.ts | 6 +- lib/commands/ECHO.spec.ts | 6 +- lib/commands/EVAL.spec.ts | 10 +- lib/commands/EXISTS.spec.ts | 6 +- lib/commands/EXPIRE.spec.ts | 6 +- lib/commands/EXPIREAT.spec.ts | 8 +- lib/commands/FLUSHALL.spec.ts | 6 +- lib/commands/FLUSHDB.spec.ts | 6 +- lib/commands/GEOADD.spec.ts | 10 +- lib/commands/GEODIST.spec.ts | 14 +- lib/commands/GEOHASH.spec.ts | 10 +- lib/commands/GEOPOS.spec.ts | 14 +- lib/commands/GEOSEARCH.spec.ts | 12 +- lib/commands/GEOSEARCHSTORE.spec.ts | 12 +- lib/commands/GEOSEARCH_WITH.spec.ts | 14 +- lib/commands/GET.spec.ts | 10 +- lib/commands/GETBIT.spec.ts | 10 +- lib/commands/GETDEL.spec.ts | 13 +- lib/commands/GETEX.spec.ts | 12 +- lib/commands/GETRANGE.spec.ts | 11 +- lib/commands/GETSET.spec.ts | 10 +- lib/commands/GET_BUFFER.spec.ts | 10 +- lib/commands/HDEL.spec.ts | 6 +- lib/commands/HELLO.spec.ts | 29 +- lib/commands/HEXISTS.spec.ts | 6 +- lib/commands/HGET.spec.ts | 6 +- lib/commands/HGETALL.spec.ts | 6 +- lib/commands/HINCRBY.spec.ts | 6 +- lib/commands/HINCRBYFLOAT.spec.ts | 6 +- lib/commands/HKEYS.spec.ts | 6 +- lib/commands/HLEN.spec.ts | 6 +- lib/commands/HMGET.spec.ts | 6 +- lib/commands/HRANDFIELD.spec.ts | 8 +- lib/commands/HRANDFIELD_COUNT.spec.ts | 8 +- .../HRANDFIELD_COUNT_WITHVALUES.spec.ts | 8 +- lib/commands/HSCAN.spec.ts | 6 +- lib/commands/HSET.spec.ts | 10 +- lib/commands/HSETNX.spec.ts | 6 +- lib/commands/HSTRLEN.spec.ts | 6 +- lib/commands/HVALS.spec.ts | 6 +- lib/commands/INCR.spec.ts | 6 +- lib/commands/INCRBY.spec.ts | 6 +- lib/commands/INCRBYFLOAT.spec.ts | 6 +- lib/commands/KEYS.spec.ts | 6 +- lib/commands/LASTSAVE.spec.ts | 6 +- lib/commands/LINDEX.spec.ts | 10 +- lib/commands/LINSERT.spec.ts | 10 +- lib/commands/LLEN.spec.ts | 10 +- lib/commands/LMOVE.spec.ts | 12 +- lib/commands/LOLWUT.spec.ts | 7 +- lib/commands/LPOP.spec.ts | 10 +- lib/commands/LPOP_COUNT.spec.ts | 12 +- lib/commands/LPOS.spec.ts | 12 +- lib/commands/LPOS_COUNT.spec.ts | 12 +- lib/commands/LPUSH.spec.ts | 10 +- lib/commands/LPUSHX.spec.ts | 10 +- lib/commands/LRANGE.spec.ts | 10 +- lib/commands/LREM.spec.ts | 10 +- lib/commands/LSET.spec.ts | 10 +- lib/commands/LTRIM.spec.ts | 10 +- lib/commands/LTRIM.ts | 2 +- lib/commands/MEMORY_DOCTOR.spec.ts | 6 +- lib/commands/MEMORY_MALLOC-STATS.spec.ts | 6 +- lib/commands/MEMORY_PURGE.spec.ts | 6 +- lib/commands/MEMORY_USAGE.spec.ts | 6 +- lib/commands/MGET.spec.ts | 10 +- lib/commands/MOVE.spec.ts | 6 +- lib/commands/MSET.spec.ts | 10 +- lib/commands/MSETNX.spec.ts | 10 +- lib/commands/PERSIST.spec.ts | 6 +- lib/commands/PEXPIRE.spec.ts | 6 +- lib/commands/PEXPIREAT.spec.ts | 8 +- lib/commands/PFADD.spec.ts | 6 +- lib/commands/PFCOUNT.spec.ts | 6 +- lib/commands/PFMERGE.spec.ts | 6 +- lib/commands/PING.spec.ts | 6 +- lib/commands/PSETEX.spec.ts | 10 +- lib/commands/PTTL.spec.ts | 6 +- lib/commands/PUBLISH.spec.ts | 6 +- lib/commands/PUBSUB_CHANNELS.spec.ts | 6 +- lib/commands/PUBSUB_NUMPAT.spec.ts | 6 +- lib/commands/PUBSUB_NUMSUB.spec.ts | 6 +- lib/commands/RANDOMKEY.spec.ts | 6 +- lib/commands/RENAME.spec.ts | 6 +- lib/commands/RENAMENX.spec.ts | 6 +- lib/commands/ROLE.spec.ts | 6 +- lib/commands/RPOP.spec.ts | 10 +- lib/commands/RPOPLPUSH.spec.ts | 10 +- lib/commands/RPOP_COUNT.spec.ts | 12 +- lib/commands/RPUSH.spec.ts | 10 +- lib/commands/RPUSHX.spec.ts | 10 +- lib/commands/SADD.spec.ts | 6 +- lib/commands/SCAN.spec.ts | 6 +- lib/commands/SCARD.spec.ts | 6 +- lib/commands/SCRIPT_DEBUG.spec.ts | 6 +- lib/commands/SCRIPT_EXISTS.spec.ts | 6 +- lib/commands/SCRIPT_FLUSH.spec.ts | 6 +- lib/commands/SCRIPT_LOAD.spec.ts | 6 +- lib/commands/SDIFF.spec.ts | 6 +- lib/commands/SDIFFSTORE.spec.ts | 6 +- lib/commands/SET.spec.ts | 13 +- lib/commands/SETBIT.spec.ts | 10 +- lib/commands/SETEX.spec.ts | 10 +- lib/commands/SETNX .spec.ts | 10 +- lib/commands/SETRANGE.spec.ts | 10 +- lib/commands/SINTER.spec.ts | 6 +- lib/commands/SINTERSTORE.spec.ts | 6 +- lib/commands/SISMEMBER.spec.ts | 8 +- lib/commands/SMEMBERS.spec.ts | 6 +- lib/commands/SMISMEMBER.spec.ts | 8 +- lib/commands/SMOVE.spec.ts | 6 +- lib/commands/SORT.spec.ts | 8 +- lib/commands/SPOP.spec.ts | 6 +- lib/commands/SRANDMEMBER.spec.ts | 6 +- lib/commands/SRANDMEMBER_COUNT.spec.ts | 6 +- lib/commands/SREM.spec.ts | 6 +- lib/commands/SSCAN.spec.ts | 6 +- lib/commands/STRLEN.spec.ts | 10 +- lib/commands/SUNION.spec.ts | 6 +- lib/commands/SUNIONSTORE.spec.ts | 6 +- lib/commands/SWAPDB.spec.ts | 6 +- lib/commands/TIME.spec.ts | 6 +- lib/commands/TOUCH.spec.ts | 6 +- lib/commands/TTL.spec.ts | 6 +- lib/commands/TYPE.spec.ts | 6 +- lib/commands/UNLINK.spec.ts | 6 +- lib/commands/UNWATCH.spec.ts | 6 +- lib/commands/WAIT.spec.ts | 6 +- lib/commands/XACK.spec.ts | 6 +- lib/commands/XADD.spec.ts | 8 +- lib/commands/XAUTOCLAIM.spec.ts | 10 +- lib/commands/XAUTOCLAIM_JUSTID.spec.ts | 8 +- lib/commands/XCLAIM.spec.ts | 8 +- lib/commands/XCLAIM_JUSTID.spec.ts | 8 +- lib/commands/XDEL.spec.ts | 6 +- lib/commands/XGROUP_CREATE.spec.ts | 6 +- lib/commands/XGROUP_CREATECONSUMER.spec.ts | 10 +- lib/commands/XGROUP_DELCONSUMER.spec.ts | 8 +- lib/commands/XGROUP_DESTROY.spec.ts | 8 +- lib/commands/XGROUP_SETID.spec.ts | 6 +- lib/commands/XINFO_CONSUMERS.spec.ts | 8 +- lib/commands/XINFO_GROUPS.spec.ts | 8 +- lib/commands/XINFO_STREAM.spec.ts | 6 +- lib/commands/XLEN.spec.ts | 6 +- lib/commands/XPENDING.spec.ts | 6 +- lib/commands/XPENDING_RANGE.spec.ts | 10 +- lib/commands/XRANGE.spec.ts | 8 +- lib/commands/XREAD.spec.ts | 10 +- lib/commands/XREADGROUP.spec.ts | 44 +- lib/commands/XREVRANGE.spec.ts | 8 +- lib/commands/XTRIM.spec.ts | 6 +- lib/commands/ZADD.spec.ts | 6 +- lib/commands/ZCARD.spec.ts | 6 +- lib/commands/ZCOUNT.spec.ts | 6 +- lib/commands/ZDIFF.spec.ts | 8 +- lib/commands/ZDIFFSTORE.spec.ts | 8 +- lib/commands/ZDIFF_WITHSCORES.spec.ts | 8 +- lib/commands/ZINCRBY.spec.ts | 6 +- lib/commands/ZINTER.spec.ts | 10 +- lib/commands/ZINTERSTORE.spec.ts | 6 +- lib/commands/ZINTER_WITHSCORES.spec.ts | 8 +- lib/commands/ZLEXCOUNT.spec.ts | 6 +- lib/commands/ZMSCORE.spec.ts | 8 +- lib/commands/ZPOPMAX.spec.ts | 10 +- lib/commands/ZPOPMAX_COUNT.spec.ts | 6 +- lib/commands/ZPOPMIN.spec.ts | 10 +- lib/commands/ZPOPMIN_COUNT.spec.ts | 6 +- lib/commands/ZRANDMEMBER.spec.ts | 8 +- lib/commands/ZRANDMEMBER_COUNT.spec.ts | 8 +- .../ZRANDMEMBER_COUNT_WITHSCORES.spec.ts | 8 +- lib/commands/ZRANGE.spec.ts | 6 +- lib/commands/ZRANGEBYLEX.spec.ts | 6 +- lib/commands/ZRANGEBYSCORE.spec.ts | 6 +- lib/commands/ZRANGEBYSCORE_WITHSCORES.spec.ts | 6 +- lib/commands/ZRANGESTORE.spec.ts | 9 +- lib/commands/ZRANGE_WITHSCORES.spec.ts | 6 +- lib/commands/ZRANK.spec.ts | 6 +- lib/commands/ZREM.spec.ts | 6 +- lib/commands/ZREMRANGEBYLEX.spec.ts | 6 +- lib/commands/ZREMRANGEBYRANK.spec.ts | 6 +- lib/commands/ZREMRANGEBYSCORE.spec.ts | 6 +- lib/commands/ZREVRANK.spec.ts | 6 +- lib/commands/ZSCAN.spec.ts | 6 +- lib/commands/ZSCORE.spec.ts | 6 +- lib/commands/ZUNION.spec.ts | 8 +- lib/commands/ZUNIONSTORE.spec.ts | 6 +- lib/commands/ZUNION_WITHSCORES.spec.ts | 8 +- lib/commands/generic-transformers.spec.ts | 2 +- lib/errors.ts | 6 + lib/test-utils.ts | 384 -------- lib/test-utils/dockers.ts | 215 +++++ lib/test-utils/index.ts | 49 + lib/test-utils/test-utils.ts | 175 ++++ package-lock.json | 903 +++++++++--------- package.json | 18 +- 240 files changed, 2125 insertions(+), 2047 deletions(-) delete mode 100644 lib/test-utils.ts create mode 100644 lib/test-utils/dockers.ts create mode 100644 lib/test-utils/index.ts create mode 100644 lib/test-utils/test-utils.ts diff --git a/.eslintrc.json b/.eslintrc.json index 9378001252..4536bc3133 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -8,5 +8,8 @@ "eslint:recommended", "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended" - ] + ], + "rules": { + "semi": [2, "always"] + } } diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7ef80685d5..b6b2dd050e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: node-version: [12.x, 14.x, 16.x] - redis-version: [5.x, 6.0.x, 6.2.x] + redis-version: [5, 6.0, 6.2] steps: - uses: actions/checkout@v2.3.4 @@ -25,17 +25,11 @@ jobs: with: node-version: ${{ matrix.node-version }} - - name: Setup Redis - uses: shogo82148/actions-setup-redis@v1.12.0 - with: - redis-version: ${{ matrix.redis-version }} - auto-start: "false" - - name: Install Packages run: npm ci - name: Run Tests - run: npm run test + run: npm run test -- --forbid-only --redis-version=${{ matrix.redis-version }} - name: Generate lcov run: ./node_modules/.bin/nyc report -r lcov diff --git a/.nycrc.json b/.nycrc.json index 925d954248..918b308a89 100644 --- a/.nycrc.json +++ b/.nycrc.json @@ -1,4 +1,4 @@ { "extends": "@istanbuljs/nyc-config-typescript", - "exclude": ["**/*.spec.ts", "lib/test-utils.ts"] + "exclude": ["**/*.spec.ts", "lib/test-utils/**/*.ts"] } \ No newline at end of file diff --git a/README.md b/README.md index 97ad01df83..9fe9e70a25 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ This pattern works especially well for blocking commands—such as `BLPOP` and ` ```typescript import { commandOptions } from 'redis'; -const blPopPromise = client.blPop(commandOptions({ isolated: true }), 'key'); +const blPopPromise = client.blPop(commandOptions({ isolated: true }), 'key', 0); await client.lPush('key', ['1', '2']); diff --git a/docs/clustering.md b/docs/clustering.md index 028ebea81d..a84dc3b1aa 100644 --- a/docs/clustering.md +++ b/docs/clustering.md @@ -45,7 +45,7 @@ import { createCluster } from 'redis'; Commands such as `GET`, `SET`, etc. will be routed by the first key, for instance `MGET 1 2 3` will be routed by the key `1`. -### [Server Commands][https://redis.io/commands#server] +### [Server Commands](https://redis.io/commands#server) Admin commands such as `MEMORY STATS`, `FLUSHALL`, etc. are not attached to the cluster, and should be executed on a specific node using `.getSlot()` or `.getAllMasters()`. diff --git a/lib/client/commands-queue.ts b/lib/client/commands-queue.ts index c07e582238..4e2a66c606 100644 --- a/lib/client/commands-queue.ts +++ b/lib/client/commands-queue.ts @@ -1,7 +1,7 @@ import LinkedList from 'yallist'; import RedisParser from 'redis-parser'; import { AbortError } from '../errors'; -import { RedisCommandRawReply } from '../commands'; +import { RedisCommandArguments, RedisCommandRawReply } from '../commands'; export interface QueueCommandOptions { asap?: boolean; @@ -10,7 +10,7 @@ export interface QueueCommandOptions { } interface CommandWaitingToBeSent extends CommandWaitingForReply { - args: Array; + args: RedisCommandArguments; chainId?: symbol; abort?: { signal: AbortSignal; @@ -107,7 +107,7 @@ export default class RedisCommandsQueue { this.#maxLength = maxLength; } - addCommand(args: Array, options?: QueueCommandOptions, bufferMode?: boolean): Promise { + addCommand(args: RedisCommandArguments, options?: QueueCommandOptions, bufferMode?: boolean): Promise { if (this.#pubSubState.subscribing || this.#pubSubState.subscribed) { return Promise.reject(new Error('Cannot send commands in PubSub mode')); } else if (this.#maxLength && this.#waitingToBeSent.length + this.#waitingForReply.length >= this.#maxLength) { @@ -247,7 +247,7 @@ export default class RedisCommandsQueue { ]); } - getCommandToSend(): Array | undefined { + getCommandToSend(): RedisCommandArguments | undefined { const toSend = this.#waitingToBeSent.shift(); if (toSend) { diff --git a/lib/client/index.spec.ts b/lib/client/index.spec.ts index bdfebed575..51dded18b1 100644 --- a/lib/client/index.spec.ts +++ b/lib/client/index.spec.ts @@ -1,11 +1,12 @@ -import { strict as assert, AssertionError } from 'assert'; -import { once } from 'events'; -import { itWithClient, TEST_REDIS_SERVERS, TestRedisServers, waitTillBeenCalled, isRedisVersionGreaterThan } from '../test-utils'; -import RedisClient from '.'; -import { AbortError, ClientClosedError, ConnectionTimeoutError, DisconnectsClientError, WatchError } from '../errors'; +import { strict as assert } from 'assert'; +import testUtils, { GLOBAL, waitTillBeenCalled } from '../test-utils'; +import RedisClient, { RedisClientType } from '.'; +import { RedisClientMultiCommandType } from './multi-command'; +import { RedisCommandArguments, RedisCommandRawReply, RedisModules, RedisScripts } from '../commands'; +import { AbortError, ClientClosedError, ConnectionTimeoutError, DisconnectsClientError, SocketClosedUnexpectedlyError, WatchError } from '../errors'; import { defineScript } from '../lua-script'; import { spy } from 'sinon'; -import { RedisNetSocketOptions } from '../client/socket'; +import { once } from 'events'; export const SQUARE_SCRIPT = defineScript({ NUMBER_OF_KEYS: 0, @@ -75,43 +76,21 @@ describe('Client', () => { } ); }); - - it('createClient with url', async () => { - const client = RedisClient.create({ - url: `redis://localhost:${(TEST_REDIS_SERVERS[TestRedisServers.OPEN].socket as RedisNetSocketOptions)!.port!.toString()}/1` - }); - - await client.connect(); - - try { - assert.equal( - await client.ping(), - 'PONG' - ); - } finally { - await client.disconnect(); - } - }) }); describe('authentication', () => { - itWithClient(TestRedisServers.PASSWORD, 'Client should be authenticated', async client => { + testUtils.testWithClient('Client should be authenticated', async client => { assert.equal( await client.ping(), 'PONG' ); - }); - - it('should not retry connecting if failed due to wrong auth', async () => { - const client = RedisClient.create({ - ...TEST_REDIS_SERVERS[TestRedisServers.PASSWORD], - password: 'wrongpassword' - }); + }, GLOBAL.SERVERS.PASSWORD); + testUtils.testWithClient('should not retry connecting if failed due to wrong auth', async client => { let message; - if (isRedisVersionGreaterThan([6, 2])) { + if (testUtils.isVersionGreaterThan([6, 2])) { message = 'WRONGPASS invalid username-password pair or user is disabled.'; - } else if (isRedisVersionGreaterThan([6])) { + } else if (testUtils.isVersionGreaterThan([6])) { message = 'WRONGPASS invalid username-password pair'; } else { message = 'ERR invalid password'; @@ -123,173 +102,216 @@ describe('Client', () => { ); assert.equal(client.isOpen, false); + }, { + ...GLOBAL.SERVERS.PASSWORD, + clientOptions: { + password: 'wrongpassword' + }, + disableClientSetup: true }); - itWithClient(TestRedisServers.PASSWORD, 'should execute AUTH before SELECT', async client => { + testUtils.testWithClient('should execute AUTH before SELECT', async client => { assert.equal( (await client.clientInfo()).db, 2 ); }, { - minimumRedisVersion: [6, 2], + ...GLOBAL.SERVERS.PASSWORD, clientOptions: { + ...GLOBAL.SERVERS.PASSWORD.clientOptions, database: 2 - } + }, + minimumDockerVersion: [6, 2] }); }); describe('legacyMode', () => { - const client = RedisClient.create({ - ...TEST_REDIS_SERVERS[TestRedisServers.OPEN], - scripts: { - square: SQUARE_SCRIPT - }, - legacyMode: true - }); + function sendCommandAsync(client: RedisClientType, args: RedisCommandArguments): Promise { + return new Promise((resolve, reject) => { + (client as any).sendCommand(args, (err: Error | undefined, reply: RedisCommandRawReply) => { + if (err) return reject(err); - before(() => client.connect()); - afterEach(() => client.v4.flushAll()); - after(() => client.disconnect()); - - it('client.sendCommand should call the callback', done => { - (client as any).sendCommand('PING', (err?: Error, reply?: string) => { - if (err) { - return done(err); - } - - try { - assert.equal(reply, 'PONG'); - done(); - } catch (err) { - done(err); - } + resolve(reply); + }); }); + } + + testUtils.testWithClient('client.sendCommand should call the callback', async client => { + assert.equal( + await sendCommandAsync(client, ['PING']), + 'PONG' + ); + }, { + ...GLOBAL.SERVERS.OPEN, + clientOptions: { + legacyMode: true + } }); - it('client.sendCommand should work without callback', async () => { - (client as any).sendCommand('PING'); + testUtils.testWithClient('client.sendCommand should work without callback', async client => { + client.sendCommand(['PING']); await client.v4.ping(); // make sure the first command was replied + }, { + ...GLOBAL.SERVERS.OPEN, + clientOptions: { + legacyMode: true + } }); - it('client.v4.sendCommand should return a promise', async () => { + testUtils.testWithClient('client.v4.sendCommand should return a promise', async client => { assert.equal( await client.v4.sendCommand(['PING']), 'PONG' ); + }, { + ...GLOBAL.SERVERS.OPEN, + clientOptions: { + legacyMode: true + } }); - it('client.{command} should accept vardict arguments', done => { - (client as any).set('a', 'b', (err?: Error, reply?: string) => { - if (err) { - return done(err); - } + function setAsync(client: RedisClientType, ...args: Array): Promise { + return new Promise((resolve, reject) => { + (client as any).set(...args, (err: Error | undefined, reply: RedisCommandRawReply) => { + if (err) return reject(err); - try { - assert.equal(reply, 'OK'); - done(); - } catch (err) { - done(err); - } - }); - }); - - it('client.{command} should accept arguments array', done => { - (client as any).set(['a', 'b'], (err?: Error, reply?: string) => { - if (err) { - return done(err); - } - - try { - assert.equal(reply, 'OK'); - done(); - } catch (err) { - done(err); - } - }); - }); - - it('client.{command} should accept mix of strings and array of strings', done => { - (client as any).set(['a'], 'b', ['XX'], (err?: Error, reply?: string) => { - if (err) { - return done(err); - } - - try { - assert.equal(reply, null); - done(); - } catch (err) { - done(err); - } - }); - }); - - it('client.multi.ping.exec should call the callback', done => { - (client as any).multi() - .ping() - .exec((err?: Error, reply?: string) => { - if (err) { - return done(err); - } - - try { - assert.deepEqual(reply, ['PONG']); - done(); - } catch (err) { - done(err); - } + resolve(reply); }); + }); + } + + testUtils.testWithClient('client.{command} should accept vardict arguments', async client => { + assert.equal( + await setAsync(client, 'a', 'b'), + 'OK' + ); + }, { + ...GLOBAL.SERVERS.OPEN, + clientOptions: { + legacyMode: true + } }); - it('client.multi.ping.exec should work without callback', async () => { - (client as any).multi() + testUtils.testWithClient('client.{command} should accept arguments array', async client => { + assert.equal( + await setAsync(client, ['a', 'b']), + 'OK' + ); + }, { + ...GLOBAL.SERVERS.OPEN, + clientOptions: { + legacyMode: true + } + }); + + testUtils.testWithClient('client.{command} should accept mix of strings and array of strings', async client => { + assert.equal( + await setAsync(client, ['a'], 'b', ['XX']), + null + ); + }, { + ...GLOBAL.SERVERS.OPEN, + clientOptions: { + legacyMode: true + } + }); + + function multiExecAsync(multi: RedisClientMultiCommandType): Promise> { + return new Promise((resolve, reject) => { + (multi as any).exec((err: Error | undefined, replies: Array) => { + if (err) return reject(err); + + resolve(replies); + }); + }); + } + + testUtils.testWithClient('client.multi.ping.exec should call the callback', async client => { + assert.deepEqual( + await multiExecAsync( + client.multi().ping() + ), + ['PONG'] + ); + }, { + ...GLOBAL.SERVERS.OPEN, + clientOptions: { + legacyMode: true + } + }); + + testUtils.testWithClient('client.multi.ping.exec should call the callback', async client => { + client.multi() .ping() .exec(); await client.v4.ping(); // make sure the first command was replied + }, { + ...GLOBAL.SERVERS.OPEN, + clientOptions: { + legacyMode: true + } }); - it('client.multi.ping.v4.ping.v4.exec should return a promise', async () => { + testUtils.testWithClient('client.multi.ping.v4.ping.v4.exec should return a promise', async client => { assert.deepEqual( - await ((client as any).multi() + await client.multi() .ping() .v4.ping() - .v4.exec()), + .v4.exec(), ['PONG', 'PONG'] ); + }, { + ...GLOBAL.SERVERS.OPEN, + clientOptions: { + legacyMode: true + } }); - it('client.{script} should return a promise', async () => { - assert.equal(await client.square(2), 4); + testUtils.testWithClient('client.{script} should return a promise', async client => { + assert.equal( + await client.square(2), + 4 + ); + }, { + ...GLOBAL.SERVERS.OPEN, + clientOptions: { + legacyMode: true, + scripts: { + square: SQUARE_SCRIPT + } + } }); }); describe('events', () => { - it('connect, ready, end', async () => { - const client = RedisClient.create(TEST_REDIS_SERVERS[TestRedisServers.OPEN]); - + testUtils.testWithClient('connect, ready, end', async client => { await Promise.all([ - client.connect(), once(client, 'connect'), - once(client, 'ready') + once(client, 'ready'), + client.connect() ]); await Promise.all([ - client.disconnect(), - once(client, 'end') + once(client, 'end'), + client.disconnect() ]); + }, { + ...GLOBAL.SERVERS.OPEN, + disableClientSetup: true }); }); describe('sendCommand', () => { - itWithClient(TestRedisServers.OPEN, 'PING', async client => { + testUtils.testWithClient('PING', async client => { assert.equal(await client.sendCommand(['PING']), 'PONG'); - }); + }, GLOBAL.SERVERS.OPEN); - itWithClient(TestRedisServers.OPEN, 'bufferMode', async client => { + testUtils.testWithClient('bufferMode', async client => { assert.deepEqual( await client.sendCommand(['PING'], undefined, true), Buffer.from('PONG') ); - }); + }, GLOBAL.SERVERS.OPEN); describe('AbortController', () => { before(function () { @@ -298,13 +320,13 @@ describe('Client', () => { } }); - itWithClient(TestRedisServers.OPEN, 'success', async client => { + testUtils.testWithClient('success', async client => { await client.sendCommand(['PING'], { signal: new AbortController().signal }); - }); + }, GLOBAL.SERVERS.OPEN); - itWithClient(TestRedisServers.OPEN, 'AbortError', client => { + testUtils.testWithClient('AbortError', client => { const controller = new AbortController(); controller.abort(); @@ -314,12 +336,12 @@ describe('Client', () => { }), AbortError ); - }); + }, GLOBAL.SERVERS.OPEN); }); }); describe('multi', () => { - itWithClient(TestRedisServers.OPEN, 'simple', async client => { + testUtils.testWithClient('simple', async client => { assert.deepEqual( await client.multi() .ping() @@ -328,23 +350,19 @@ describe('Client', () => { .exec(), ['PONG', 'OK', 'value'] ); - }); - - itWithClient(TestRedisServers.OPEN, 'should reject the whole chain on error', client => { - client.on('error', () => { - // ignore errors - }); + }, GLOBAL.SERVERS.OPEN); + testUtils.testWithClient('should reject the whole chain on error', client => { return assert.rejects( client.multi() .ping() - .addCommand(['DEBUG', 'RESTART']) + .addCommand(['INVALID COMMAND']) .ping() .exec() ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithClient(TestRedisServers.OPEN, 'with script', async client => { + testUtils.testWithClient('with script', async client => { assert.deepEqual( await client.multi() .square(2) @@ -352,6 +370,7 @@ describe('Client', () => { [4] ); }, { + ...GLOBAL.SERVERS.OPEN, clientOptions: { scripts: { square: SQUARE_SCRIPT @@ -359,7 +378,7 @@ describe('Client', () => { } }); - itWithClient(TestRedisServers.OPEN, 'WatchError', async client => { + testUtils.testWithClient('WatchError', async client => { await client.watch('key'); await client.set( @@ -376,24 +395,25 @@ describe('Client', () => { .exec(), WatchError ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithClient(TestRedisServers.OPEN, 'execAsPipeline', async client => { + testUtils.testWithClient('execAsPipeline', async client => { assert.deepEqual( await client.multi() .ping() .exec(true), ['PONG'] ); - }); + }, GLOBAL.SERVERS.OPEN); }); - itWithClient(TestRedisServers.OPEN, 'scripts', async client => { + testUtils.testWithClient('scripts', async client => { assert.equal( await client.square(2), 4 ); }, { + ...GLOBAL.SERVERS.OPEN, clientOptions: { scripts: { square: SQUARE_SCRIPT @@ -401,12 +421,13 @@ describe('Client', () => { } }); - itWithClient(TestRedisServers.OPEN, 'modules', async client => { + testUtils.testWithClient('modules', async client => { assert.equal( await client.module.echo('message'), 'message' ); }, { + ...GLOBAL.SERVERS.OPEN, clientOptions: { modules: { module: { @@ -423,7 +444,7 @@ describe('Client', () => { } }); - itWithClient(TestRedisServers.OPEN, 'executeIsolated', async client => { + testUtils.testWithClient('executeIsolated', async client => { await client.sendCommand(['CLIENT', 'SETNAME', 'client']); assert.equal( @@ -432,35 +453,35 @@ describe('Client', () => { ), null ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithClient(TestRedisServers.OPEN, 'should reconnect after DEBUG RESTART', async client => { - client.on('error', () => { - // ignore errors - }); + async function killClient(client: RedisClientType): Promise { + const onceErrorPromise = once(client, 'error'); + await client.sendCommand(['QUIT']); + await Promise.all([ + onceErrorPromise, + assert.rejects(client.ping(), SocketClosedUnexpectedlyError) + ]); + } - await client.sendCommand(['CLIENT', 'SETNAME', 'client']); - await assert.rejects(client.sendCommand(['DEBUG', 'RESTART'])); - assert.ok(await client.sendCommand(['CLIENT', 'GETNAME']) === null); - }); - - itWithClient(TestRedisServers.OPEN, 'should SELECT db after reconnection', async client => { - client.on('error', () => { - // ignore errors - }); + testUtils.testWithClient('should reconnect when socket disconnects', async client => { + await killClient(client); + await assert.doesNotReject(client.ping()); + }, GLOBAL.SERVERS.OPEN); + testUtils.testWithClient('should remember selected db', async client => { await client.select(1); - await assert.rejects(client.sendCommand(['DEBUG', 'RESTART'])); + await killClient(client); assert.equal( (await client.clientInfo()).db, 1 ); }, { - // because of CLIENT INFO - minimumRedisVersion: [6, 2] + ...GLOBAL.SERVERS.OPEN, + minimumDockerVersion: [6, 2] // CLIENT INFO }); - itWithClient(TestRedisServers.OPEN, 'scanIterator', async client => { + testUtils.testWithClient('scanIterator', async client => { const promises = [], keys = new Set(); for (let i = 0; i < 100; i++) { @@ -477,9 +498,9 @@ describe('Client', () => { } assert.deepEqual(keys, results); - }); + }, GLOBAL.SERVERS.OPEN); - itWithClient(TestRedisServers.OPEN, 'hScanIterator', async client => { + testUtils.testWithClient('hScanIterator', async client => { const hash: Record = {}; for (let i = 0; i < 100; i++) { hash[i.toString()] = i.toString(); @@ -493,9 +514,9 @@ describe('Client', () => { } assert.deepEqual(hash, results); - }); + }, GLOBAL.SERVERS.OPEN); - itWithClient(TestRedisServers.OPEN, 'sScanIterator', async client => { + testUtils.testWithClient('sScanIterator', async client => { const members = new Set(); for (let i = 0; i < 100; i++) { members.add(i.toString()); @@ -509,9 +530,9 @@ describe('Client', () => { } assert.deepEqual(members, results); - }); + }, GLOBAL.SERVERS.OPEN); - itWithClient(TestRedisServers.OPEN, 'zScanIterator', async client => { + testUtils.testWithClient('zScanIterator', async client => { const members = []; for (let i = 0; i < 100; i++) { members.push({ @@ -537,9 +558,9 @@ describe('Client', () => { [...map.entries()].sort(sort), members.map(member => [member.value, member.score]).sort(sort) ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithClient(TestRedisServers.OPEN, 'PubSub', async publisher => { + testUtils.testWithClient('PubSub', async publisher => { const subscriber = publisher.duplicate(); await subscriber.connect(); @@ -602,76 +623,59 @@ describe('Client', () => { } finally { await subscriber.disconnect(); } - }); + }, GLOBAL.SERVERS.OPEN); - it('ConnectionTimeoutError', async () => { - const client = RedisClient.create({ + testUtils.testWithClient('ConnectionTimeoutError', async client => { + const promise = assert.rejects(client.connect(), ConnectionTimeoutError), + start = process.hrtime.bigint(); + + while (process.hrtime.bigint() - start < 1_000_000) { + // block the event loop for 1ms, to make sure the connection will timeout + } + + await promise; + }, { + ...GLOBAL.SERVERS.OPEN, + clientOptions: { socket: { - ...TEST_REDIS_SERVERS[TestRedisServers.OPEN], connectTimeout: 1 } - }); - - try { - const promise = assert.rejects(client.connect(), ConnectionTimeoutError), - start = process.hrtime.bigint(); - - while (process.hrtime.bigint() - start < 1_000_000) { - // block the event loop for 1ms, to make sure the connection will timeout - } - - await promise; - } catch (err) { - if (err instanceof AssertionError) { - await client.disconnect(); - } - - throw err; - } + }, + disableClientSetup: true }); - it('client.quit', async () => { - const client = RedisClient.create(TEST_REDIS_SERVERS[TestRedisServers.OPEN]); - + testUtils.testWithClient('client.quit', async client => { await client.connect(); - try { - const pingPromise = client.ping(), - quitPromise = client.quit(); - assert.equal(client.isOpen, false); + const pingPromise = client.ping(), + quitPromise = client.quit(); + assert.equal(client.isOpen, false); - const [ping] = await Promise.all([ - pingPromise, - assert.doesNotReject(quitPromise), - assert.rejects(client.ping(), ClientClosedError) - ]); + const [ping] = await Promise.all([ + pingPromise, + assert.doesNotReject(quitPromise), + assert.rejects(client.ping(), ClientClosedError) + ]); - assert.equal(ping, 'PONG'); - } finally { - if (client.isOpen) { - await client.disconnect(); - } - } + assert.equal(ping, 'PONG'); + }, { + ...GLOBAL.SERVERS.OPEN, + disableClientSetup: true }); - it('client.disconnect', async () => { - const client = RedisClient.create(TEST_REDIS_SERVERS[TestRedisServers.OPEN]); - + testUtils.testWithClient('client.disconnect', async client => { await client.connect(); - try { - const pingPromise = client.ping(), - disconnectPromise = client.disconnect(); - assert.equal(client.isOpen, false); - await Promise.all([ - assert.rejects(pingPromise, DisconnectsClientError), - assert.doesNotReject(disconnectPromise), - assert.rejects(client.ping(), ClientClosedError) - ]); - } finally { - if (client.isOpen) { - await client.disconnect(); - } - } + const pingPromise = client.ping(), + disconnectPromise = client.disconnect(); + assert.equal(client.isOpen, false); + await Promise.all([ + assert.rejects(pingPromise, DisconnectsClientError), + assert.doesNotReject(disconnectPromise), + assert.rejects(client.ping(), ClientClosedError) + ]); + }, { + ...GLOBAL.SERVERS.OPEN, + disableClientSetup: true }); }); diff --git a/lib/client/index.ts b/lib/client/index.ts index a76a56ace7..40499cbf7c 100644 --- a/lib/client/index.ts +++ b/lib/client/index.ts @@ -9,7 +9,7 @@ import { CommandOptions, commandOptions, isCommandOptions } from '../command-opt import { ScanOptions, ZMember } from '../commands/generic-transformers'; import { ScanCommandOptions } from '../commands/SCAN'; import { HScanTuple } from '../commands/HSCAN'; -import { encodeCommand, extendWithCommands, extendWithModulesAndScripts, transformCommandArguments, transformCommandReply } from '../commander'; +import { extendWithCommands, extendWithModulesAndScripts, transformCommandArguments, transformCommandReply } from '../commander'; import { Pool, Options as PoolOptions, createPool } from 'generic-pool'; import { ClientClosedError, DisconnectsClientError } from '../errors'; import { URL } from 'url'; @@ -217,7 +217,7 @@ export default class RedisClient } if (promises.length) { - this.#tick(); + this.#tick(true); await Promise.all(promises); } }; @@ -435,8 +435,8 @@ export default class RedisClient quit = this.QUIT; - #tick(): void { - if (!this.#socket.isSocketExists || this.#socket.writableNeedDrain) { + #tick(force = false): void { + if (this.#socket.writableNeedDrain || (!force && !this.#socket.isReady)) { return; } @@ -446,9 +446,7 @@ export default class RedisClient const args = this.#queue.getCommandToSend(); if (args === undefined) break; - for (const toWrite of encodeCommand(args)) { - this.#socket.write(toWrite); - } + this.#socket.writeCommand(args); } } @@ -485,7 +483,7 @@ export default class RedisClient for (const key of reply.keys) { yield key; } - } while (cursor !== 0) + } while (cursor !== 0); } async* hScanIterator(key: string, options?: ScanOptions): AsyncIterable { @@ -496,7 +494,7 @@ export default class RedisClient for (const tuple of reply.tuples) { yield tuple; } - } while (cursor !== 0) + } while (cursor !== 0); } async* sScanIterator(key: string, options?: ScanOptions): AsyncIterable { @@ -507,7 +505,7 @@ export default class RedisClient for (const member of reply.members) { yield member; } - } while (cursor !== 0) + } while (cursor !== 0); } async* zScanIterator(key: string, options?: ScanOptions): AsyncIterable { @@ -518,15 +516,13 @@ export default class RedisClient for (const member of reply.members) { yield member; } - } while (cursor !== 0) + } while (cursor !== 0); } async disconnect(): Promise { this.#queue.flushAll(new DisconnectsClientError()); - await Promise.all([ - this.#socket.disconnect(), - this.#destroyIsolationPool() - ]); + this.#socket.disconnect(); + await this.#destroyIsolationPool(); } async #destroyIsolationPool(): Promise { diff --git a/lib/client/socket.spec.ts b/lib/client/socket.spec.ts index 11c02d0885..263320bbf7 100644 --- a/lib/client/socket.spec.ts +++ b/lib/client/socket.spec.ts @@ -33,6 +33,6 @@ describe('Socket', () => { return assert.rejects(socket.connect(), { message: '50' }); - }) + }); }); }); diff --git a/lib/client/socket.ts b/lib/client/socket.ts index 923d14dffd..3a81660471 100644 --- a/lib/client/socket.ts +++ b/lib/client/socket.ts @@ -1,7 +1,9 @@ import EventEmitter from 'events'; import net from 'net'; import tls from 'tls'; -import { ConnectionTimeoutError, ClientClosedError } from '../errors'; +import { encodeCommand } from '../commander'; +import { RedisCommandArguments } from '../commands'; +import { ConnectionTimeoutError, ClientClosedError, SocketClosedUnexpectedlyError } from '../errors'; import { promiseTimeout } from '../utils'; export interface RedisSocketCommonOptions { @@ -72,8 +74,10 @@ export default class RedisSocket extends EventEmitter { return this.#isOpen; } - get isSocketExists(): boolean { - return !!this.#socket; + #isReady = false; + + get isReady(): boolean { + return this.#isReady; } // `writable.writableNeedDrain` was added in v15.2.0 and therefore can't be used @@ -93,33 +97,39 @@ export default class RedisSocket extends EventEmitter { async connect(): Promise { if (this.#isOpen) { - throw new Error('Socket is connection/connecting'); + throw new Error('Socket already opened'); } - this.#isOpen = true; - - try { - await this.#connect(); - } catch (err) { - this.#isOpen = false; - throw err; - } + return this.#connect(); } async #connect(hadError?: boolean): Promise { + this.#isOpen = true; this.#socket = await this.#retryConnection(0, hadError); + this.#writableNeedDrain = false; + + if (!this.#isOpen) { + this.disconnect(); + return; + } + this.emit('connect'); if (this.#initiator) { try { await this.#initiator(); } catch (err) { - this.#socket.end(); + this.#socket.destroy(); this.#socket = undefined; + this.#isOpen = false; throw err; } + + if (!this.#isOpen) return; } + this.#isReady = true; + this.emit('ready'); } @@ -168,7 +178,7 @@ export default class RedisSocket extends EventEmitter { .once('error', (err: Error) => this.#onSocketError(err)) .once('close', hadError => { if (!hadError && this.#isOpen) { - this.#onSocketError(new Error('Socket closed unexpectedly')); + this.#onSocketError(new SocketClosedUnexpectedlyError()); } }) .on('drain', () => { @@ -197,33 +207,32 @@ export default class RedisSocket extends EventEmitter { } #onSocketError(err: Error): void { - this.#socket = undefined; + this.#isReady = false; this.emit('error', err); - this.#connect(true) - .catch(err => this.emit('error', err)); + this.#connect(true).catch(() => { + // the error was already emitted, silently ignore it + }); } - write(toWrite: string | Buffer): boolean { + writeCommand(args: RedisCommandArguments): void { if (!this.#socket) { throw new ClientClosedError(); } - const wasFullyWritten = this.#socket.write(toWrite); - this.#writableNeedDrain = !wasFullyWritten; - return wasFullyWritten; + for (const toWrite of encodeCommand(args)) { + this.#writableNeedDrain = !this.#socket.write(toWrite); + } } - async disconnect(ignoreIsOpen = false): Promise { - if ((!ignoreIsOpen && !this.#isOpen) || !this.#socket) { + disconnect(): void { + if (!this.#socket) { throw new ClientClosedError(); } else { - this.#isOpen = false; + this.#isOpen = this.#isReady = false; } - this.#socket.end(); - this.#socket.removeAllListeners('data'); - await EventEmitter.once(this.#socket, 'end'); + this.#socket.destroy(); this.#socket = undefined; this.emit('end'); } @@ -234,14 +243,8 @@ export default class RedisSocket extends EventEmitter { } this.#isOpen = false; - - try { - await fn(); - await this.disconnect(true); - } catch (err) { - this.#isOpen = true; - throw err; - } + await fn(); + this.disconnect(); } #isCorked = false; diff --git a/lib/cluster/index.spec.ts b/lib/cluster/index.spec.ts index f222739538..66319460f6 100644 --- a/lib/cluster/index.spec.ts +++ b/lib/cluster/index.spec.ts @@ -1,17 +1,11 @@ import { strict as assert } from 'assert'; -import RedisCluster from '.'; -import { defineScript } from '../lua-script'; -import { itWithCluster, itWithDedicatedCluster, TestRedisClusters, TEST_REDIS_CLUSTERES } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import calculateSlot from 'cluster-key-slot'; import { ClusterSlotStates } from '../commands/CLUSTER_SETSLOT'; +import { SQUARE_SCRIPT } from '../client/index.spec'; describe('Cluster', () => { - it('sendCommand', async () => { - const cluster = RedisCluster.create({ - ...TEST_REDIS_CLUSTERES[TestRedisClusters.OPEN], - useReplicas: true - }); - + testUtils.testWithCluster('sendCommand', async cluster => { await cluster.connect(); try { @@ -26,9 +20,9 @@ describe('Cluster', () => { } finally { await cluster.disconnect(); } - }); + }, GLOBAL.CLUSTERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'multi', async cluster => { + testUtils.testWithCluster('multi', async cluster => { const key = 'key'; assert.deepEqual( await cluster.multi() @@ -37,40 +31,23 @@ describe('Cluster', () => { .exec(), ['OK', 'value'] ); - }); + }, GLOBAL.CLUSTERS.OPEN); - it('scripts', async () => { - const cluster = RedisCluster.create({ - ...TEST_REDIS_CLUSTERES[TestRedisClusters.OPEN], + testUtils.testWithCluster('scripts', async cluster => { + assert.equal( + await cluster.square(2), + 4 + ); + }, { + ...GLOBAL.CLUSTERS.OPEN, + clusterConfiguration: { scripts: { - add: defineScript({ - NUMBER_OF_KEYS: 0, - SCRIPT: 'return ARGV[1] + 1;', - transformArguments(number: number): Array { - assert.equal(number, 1); - return [number.toString()]; - }, - transformReply(reply: number): number { - assert.equal(reply, 2); - return reply; - } - }) + square: SQUARE_SCRIPT } - }); - - await cluster.connect(); - - try { - assert.equal( - await cluster.add(1), - 2 - ); - } finally { - await cluster.disconnect(); } }); - itWithDedicatedCluster('should handle live resharding', async cluster => { + testUtils.testWithCluster('should handle live resharding', async cluster => { const key = 'key', value = 'value'; await cluster.set(key, value); @@ -110,5 +87,7 @@ describe('Cluster', () => { await cluster.get(key), value ); + }, { + serverArguments: [] }); }); diff --git a/lib/commands/ACL_CAT.spec.ts b/lib/commands/ACL_CAT.spec.ts index 77ed1cb7a0..521871a1c6 100644 --- a/lib/commands/ACL_CAT.spec.ts +++ b/lib/commands/ACL_CAT.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils from '../test-utils'; import { transformArguments } from './ACL_CAT'; describe('ACL CAT', () => { - describeHandleMinimumRedisVersion([6]); + testUtils.isVersionGreaterThanHook([6]); describe('transformArguments', () => { it('simple', () => { diff --git a/lib/commands/ACL_DELUSER.spec.ts b/lib/commands/ACL_DELUSER.spec.ts index c64e8db196..5c5ea2fa2a 100644 --- a/lib/commands/ACL_DELUSER.spec.ts +++ b/lib/commands/ACL_DELUSER.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { describeHandleMinimumRedisVersion, itWithClient, TestRedisServers } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ACL_DELUSER'; describe('ACL DELUSER', () => { - describeHandleMinimumRedisVersion([6]); + testUtils.isVersionGreaterThanHook([6]); describe('transformArguments', () => { it('string', () => { @@ -21,10 +21,10 @@ describe('ACL DELUSER', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.aclDelUser', async client => { + testUtils.testWithClient('client.aclDelUser', async client => { assert.equal( await client.aclDelUser('dosenotexists'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ACL_GENPASS.spec.ts b/lib/commands/ACL_GENPASS.spec.ts index a288a4f714..3b2a022f97 100644 --- a/lib/commands/ACL_GENPASS.spec.ts +++ b/lib/commands/ACL_GENPASS.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils from '../test-utils'; import { transformArguments } from './ACL_GENPASS'; describe('ACL GENPASS', () => { - describeHandleMinimumRedisVersion([6]); + testUtils.isVersionGreaterThanHook([6]); describe('transformArguments', () => { it('simple', () => { diff --git a/lib/commands/ACL_GETUSER.spec.ts b/lib/commands/ACL_GETUSER.spec.ts index e3446162da..fcc10768e6 100644 --- a/lib/commands/ACL_GETUSER.spec.ts +++ b/lib/commands/ACL_GETUSER.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { describeHandleMinimumRedisVersion, isRedisVersionGreaterThan, itWithClient, TestRedisServers } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ACL_GETUSER'; describe('ACL GETUSER', () => { - describeHandleMinimumRedisVersion([6]); + testUtils.isVersionGreaterThanHook([6]); it('transformArguments', () => { assert.deepEqual( @@ -12,14 +12,14 @@ describe('ACL GETUSER', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.aclGetUser', async client => { + testUtils.testWithClient('client.aclGetUser', async client => { assert.deepEqual( await client.aclGetUser('default'), { passwords: [], commands: '+@all', keys: ['*'], - ...(isRedisVersionGreaterThan([6, 2]) ? { + ...(testUtils.isVersionGreaterThan([6, 2]) ? { flags: ['on', 'allkeys', 'allchannels', 'allcommands', 'nopass'], channels: ['*'] } : { @@ -28,5 +28,5 @@ describe('ACL GETUSER', () => { }) } ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ACL_LIST.spec.ts b/lib/commands/ACL_LIST.spec.ts index ab6bae762f..9f9156db7a 100644 --- a/lib/commands/ACL_LIST.spec.ts +++ b/lib/commands/ACL_LIST.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils from '../test-utils'; import { transformArguments } from './ACL_LIST'; describe('ACL LIST', () => { - describeHandleMinimumRedisVersion([6]); + testUtils.isVersionGreaterThanHook([6]); it('transformArguments', () => { assert.deepEqual( diff --git a/lib/commands/ACL_LOAD.spec.ts b/lib/commands/ACL_LOAD.spec.ts index d173d7f135..703d5eeb25 100644 --- a/lib/commands/ACL_LOAD.spec.ts +++ b/lib/commands/ACL_LOAD.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils from '../test-utils'; import { transformArguments } from './ACL_SAVE'; describe('ACL SAVE', () => { - describeHandleMinimumRedisVersion([6]); + testUtils.isVersionGreaterThanHook([6]); it('transformArguments', () => { assert.deepEqual( diff --git a/lib/commands/ACL_LOG.spec.ts b/lib/commands/ACL_LOG.spec.ts index 3ce76ce456..a8296d31da 100644 --- a/lib/commands/ACL_LOG.spec.ts +++ b/lib/commands/ACL_LOG.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils from '../test-utils'; import { transformArguments, transformReply } from './ACL_LOG'; describe('ACL LOG', () => { - describeHandleMinimumRedisVersion([6]); + testUtils.isVersionGreaterThanHook([6]); describe('transformArguments', () => { it('simple', () => { diff --git a/lib/commands/ACL_LOG_RESET.spec.ts b/lib/commands/ACL_LOG_RESET.spec.ts index 3f0e628d9f..5d26e45d04 100644 --- a/lib/commands/ACL_LOG_RESET.spec.ts +++ b/lib/commands/ACL_LOG_RESET.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils from '../test-utils'; import { transformArguments } from './ACL_LOG_RESET'; describe('ACL LOG RESET', () => { - describeHandleMinimumRedisVersion([6]); + testUtils.isVersionGreaterThanHook([6]); it('transformArguments', () => { assert.deepEqual( diff --git a/lib/commands/ACL_SAVE.spec.ts b/lib/commands/ACL_SAVE.spec.ts index b34c7bb0e6..f4de312bb7 100644 --- a/lib/commands/ACL_SAVE.spec.ts +++ b/lib/commands/ACL_SAVE.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils from '../test-utils'; import { transformArguments } from './ACL_LOAD'; describe('ACL LOAD', () => { - describeHandleMinimumRedisVersion([6]); + testUtils.isVersionGreaterThanHook([6]); it('transformArguments', () => { assert.deepEqual( diff --git a/lib/commands/ACL_SETUSER.spec.ts b/lib/commands/ACL_SETUSER.spec.ts index f3badfcdca..9c8ea8a59e 100644 --- a/lib/commands/ACL_SETUSER.spec.ts +++ b/lib/commands/ACL_SETUSER.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils from '../test-utils'; import { transformArguments } from './ACL_SETUSER'; describe('ACL SETUSER', () => { - describeHandleMinimumRedisVersion([6]); + testUtils.isVersionGreaterThanHook([6]); describe('transformArguments', () => { it('string', () => { diff --git a/lib/commands/ACL_USERS.spec.ts b/lib/commands/ACL_USERS.spec.ts index 14b76725fc..35e06ce849 100644 --- a/lib/commands/ACL_USERS.spec.ts +++ b/lib/commands/ACL_USERS.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils from '../test-utils'; import { transformArguments } from './ACL_USERS'; describe('ACL USERS', () => { - describeHandleMinimumRedisVersion([6]); + testUtils.isVersionGreaterThanHook([6]); it('transformArguments', () => { assert.deepEqual( diff --git a/lib/commands/ACL_WHOAMI.spec.ts b/lib/commands/ACL_WHOAMI.spec.ts index a933057ea9..32eb327bee 100644 --- a/lib/commands/ACL_WHOAMI.spec.ts +++ b/lib/commands/ACL_WHOAMI.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils from '../test-utils'; import { transformArguments } from './ACL_WHOAMI'; describe('ACL WHOAMI', () => { - describeHandleMinimumRedisVersion([6]); + testUtils.isVersionGreaterThanHook([6]); it('transformArguments', () => { assert.deepEqual( diff --git a/lib/commands/APPEND.spec.ts b/lib/commands/APPEND.spec.ts index 283ab80795..2335386684 100644 --- a/lib/commands/APPEND.spec.ts +++ b/lib/commands/APPEND.spec.ts @@ -1,7 +1,7 @@ import { strict as assert } from 'assert'; import { transformArguments } from './APPEND'; -describe('AUTH', () => { +describe('APPEND', () => { it('transformArguments', () => { assert.deepEqual( transformArguments('key', 'value'), diff --git a/lib/commands/BITCOUNT.spec.ts b/lib/commands/BITCOUNT.spec.ts index bf4cf39cab..8919957cf9 100644 --- a/lib/commands/BITCOUNT.spec.ts +++ b/lib/commands/BITCOUNT.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './BITCOUNT'; describe('BITCOUNT', () => { @@ -22,10 +22,10 @@ describe('BITCOUNT', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.bitCount', async client => { + testUtils.testWithClient('client.bitCount', async client => { assert.equal( await client.bitCount('key'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/BITFIELD.spec.ts b/lib/commands/BITFIELD.spec.ts index 4d6d9d11c1..93a5cb08a6 100644 --- a/lib/commands/BITFIELD.spec.ts +++ b/lib/commands/BITFIELD.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './BITFIELD'; describe('BITFIELD', () => { @@ -33,10 +33,10 @@ describe('BITFIELD', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.bitField', async client => { + testUtils.testWithClient('client.bitField', async client => { assert.deepEqual( await client.bitField('key', []), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/BITOP.spec.ts b/lib/commands/BITOP.spec.ts index aa863e5f2d..554530d56f 100644 --- a/lib/commands/BITOP.spec.ts +++ b/lib/commands/BITOP.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './BITOP'; describe('BITOP', () => { @@ -19,17 +19,17 @@ describe('BITOP', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.bitOp', async client => { + testUtils.testWithClient('client.bitOp', async client => { assert.equal( await client.bitOp('AND', 'destKey', 'key'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.bitOp', async cluster => { + testUtils.testWithCluster('cluster.bitOp', async cluster => { assert.equal( await cluster.bitOp('AND', '{tag}destKey', '{tag}key'), 0 ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/BITPOS.spec.ts b/lib/commands/BITPOS.spec.ts index ad08e708c5..354deea619 100644 --- a/lib/commands/BITPOS.spec.ts +++ b/lib/commands/BITPOS.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './BITPOS'; describe('BITPOS', () => { @@ -26,17 +26,17 @@ describe('BITPOS', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.bitPos', async client => { + testUtils.testWithClient('client.bitPos', async client => { assert.equal( await client.bitPos('key', 1, 1), -1 ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.bitPos', async cluster => { + testUtils.testWithCluster('cluster.bitPos', async cluster => { assert.equal( await cluster.bitPos('key', 1, 1), -1 ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/BLMOVE.spec.ts b/lib/commands/BLMOVE.spec.ts index b942864758..3b86c1ec91 100644 --- a/lib/commands/BLMOVE.spec.ts +++ b/lib/commands/BLMOVE.spec.ts @@ -1,10 +1,10 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './BLMOVE'; import { commandOptions } from '../../index'; describe('BLMOVE', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); it('transformArguments', () => { assert.deepEqual( @@ -13,7 +13,7 @@ describe('BLMOVE', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.blMove', async client => { + testUtils.testWithClient('client.blMove', async client => { const [blMoveReply] = await Promise.all([ client.blMove(commandOptions({ isolated: true @@ -25,9 +25,9 @@ describe('BLMOVE', () => { blMoveReply, 'element' ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.blMove', async cluster => { + testUtils.testWithCluster('cluster.blMove', async cluster => { const [blMoveReply] = await Promise.all([ cluster.blMove(commandOptions({ isolated: true @@ -39,5 +39,5 @@ describe('BLMOVE', () => { blMoveReply, 'element' ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/BLPOP.spec.ts b/lib/commands/BLPOP.spec.ts index 651dd09eaf..4b93c0b43b 100644 --- a/lib/commands/BLPOP.spec.ts +++ b/lib/commands/BLPOP.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments, transformReply } from './BLPOP'; import { commandOptions } from '../../index'; @@ -39,7 +39,7 @@ describe('BLPOP', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.blPop', async client => { + testUtils.testWithClient('client.blPop', async client => { const [ blPopReply ] = await Promise.all([ client.blPop( commandOptions({ isolated: true }), @@ -56,9 +56,9 @@ describe('BLPOP', () => { element: 'element' } ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.blPop', async cluster => { + testUtils.testWithCluster('cluster.blPop', async cluster => { const [ blPopReply ] = await Promise.all([ cluster.blPop( commandOptions({ isolated: true }), @@ -75,5 +75,5 @@ describe('BLPOP', () => { element: 'element' } ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/BRPOP.spec.ts b/lib/commands/BRPOP.spec.ts index 9a7d0bbc37..fc203e1abd 100644 --- a/lib/commands/BRPOP.spec.ts +++ b/lib/commands/BRPOP.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments, transformReply } from './BRPOP'; import { commandOptions } from '../../index'; @@ -39,7 +39,7 @@ describe('BRPOP', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.brPop', async client => { + testUtils.testWithClient('client.brPop', async client => { const [ brPopReply ] = await Promise.all([ client.brPop( commandOptions({ isolated: true }), @@ -56,9 +56,9 @@ describe('BRPOP', () => { element: 'element' } ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.brPop', async cluster => { + testUtils.testWithCluster('cluster.brPop', async cluster => { const [ brPopReply ] = await Promise.all([ cluster.brPop( commandOptions({ isolated: true }), @@ -75,5 +75,5 @@ describe('BRPOP', () => { element: 'element' } ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/BRPOPLPUSH.spec.ts b/lib/commands/BRPOPLPUSH.spec.ts index 08bcf5e4d9..214af4553a 100644 --- a/lib/commands/BRPOPLPUSH.spec.ts +++ b/lib/commands/BRPOPLPUSH.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './BRPOPLPUSH'; import { commandOptions } from '../../index'; @@ -11,7 +11,7 @@ describe('BRPOPLPUSH', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.brPopLPush', async client => { + testUtils.testWithClient('client.brPopLPush', async client => { const [ popReply ] = await Promise.all([ client.brPopLPush( commandOptions({ isolated: true }), @@ -26,9 +26,9 @@ describe('BRPOPLPUSH', () => { popReply, 'element' ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.brPopLPush', async cluster => { + testUtils.testWithCluster('cluster.brPopLPush', async cluster => { const [ popReply ] = await Promise.all([ cluster.brPopLPush( commandOptions({ isolated: true }), @@ -43,5 +43,5 @@ describe('BRPOPLPUSH', () => { popReply, 'element' ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/BZPOPMAX.spec.ts b/lib/commands/BZPOPMAX.spec.ts index 090dfba096..e1c3747846 100644 --- a/lib/commands/BZPOPMAX.spec.ts +++ b/lib/commands/BZPOPMAX.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments, transformReply } from './BZPOPMAX'; import { commandOptions } from '../../index'; @@ -40,7 +40,7 @@ describe('BZPOPMAX', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.bzPopMax', async client => { + testUtils.testWithClient('client.bzPopMax', async client => { const [ bzPopMaxReply ] = await Promise.all([ client.bzPopMax( commandOptions({ isolated: true }), @@ -61,5 +61,5 @@ describe('BZPOPMAX', () => { score: 1 } ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/BZPOPMIN.spec.ts b/lib/commands/BZPOPMIN.spec.ts index 8b8977f9b3..4cd1ec1b22 100644 --- a/lib/commands/BZPOPMIN.spec.ts +++ b/lib/commands/BZPOPMIN.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments, transformReply } from './BZPOPMIN'; import { commandOptions } from '../../index'; @@ -40,7 +40,7 @@ describe('BZPOPMIN', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.bzPopMin', async client => { + testUtils.testWithClient('client.bzPopMin', async client => { const [ bzPopMinReply ] = await Promise.all([ client.bzPopMin( commandOptions({ isolated: true }), @@ -61,5 +61,5 @@ describe('BZPOPMIN', () => { score: 1 } ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/CLIENT_ID.spec.ts b/lib/commands/CLIENT_ID.spec.ts index cb7dfd9f73..6792a8c31b 100644 --- a/lib/commands/CLIENT_ID.spec.ts +++ b/lib/commands/CLIENT_ID.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './CLIENT_ID'; describe('CLIENT ID', () => { @@ -10,10 +10,10 @@ describe('CLIENT ID', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.clientId', async client => { + testUtils.testWithClient('client.clientId', async client => { assert.equal( typeof (await client.clientId()), 'number' ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/CLUSTER_SLOTS.spec.ts b/lib/commands/CLUSTER_SLOTS.spec.ts index ec6773bcdd..6efbfe13ce 100644 --- a/lib/commands/CLUSTER_SLOTS.spec.ts +++ b/lib/commands/CLUSTER_SLOTS.spec.ts @@ -71,6 +71,6 @@ describe('CLUSTER SLOTS', () => { id: '58e6e48d41228013e5d9c1c37c5060693925e97e' }] }] - ) + ); }); }); diff --git a/lib/commands/COMMAND.spec.ts b/lib/commands/COMMAND.spec.ts index 1f036dadc1..baad79845a 100644 --- a/lib/commands/COMMAND.spec.ts +++ b/lib/commands/COMMAND.spec.ts @@ -1,7 +1,7 @@ import { strict as assert } from 'assert'; -import { itWithClient, TestRedisServers } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './COMMAND'; -import { CommandCategories, CommandFlags } from './generic-transformers'; +import { assertPingCommand } from './COMMAND_INFO.spec'; describe('COMMAND', () => { it('transformArguments', () => { @@ -11,20 +11,7 @@ describe('COMMAND', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.command', async client => { - assert.deepEqual( - (await client.command()).find(command => command.name === 'ping'), - { - name: 'ping', - arity: -1, - flags: new Set([CommandFlags.STALE, CommandFlags.FAST]), - firstKeyIndex: 0, - lastKeyIndex: 0, - step: 0, - categories: new Set([CommandCategories.FAST, CommandCategories.CONNECTION]) - } - ); - }, { - minimumRedisVersion: [6] - }); + testUtils.testWithClient('client.command', async client => { + assertPingCommand((await client.command()).find(command => command.name === 'ping')); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/COMMAND_COUNT.spec.ts b/lib/commands/COMMAND_COUNT.spec.ts index 23e83c71ce..71482382f6 100644 --- a/lib/commands/COMMAND_COUNT.spec.ts +++ b/lib/commands/COMMAND_COUNT.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './COMMAND_COUNT'; describe('COMMAND COUNT', () => { @@ -10,10 +10,10 @@ describe('COMMAND COUNT', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.commandCount', async client => { + testUtils.testWithClient('client.commandCount', async client => { assert.equal( typeof await client.commandCount(), 'number' ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/COMMAND_GETKEYS.spec.ts b/lib/commands/COMMAND_GETKEYS.spec.ts index f2630db9af..a92d032c5d 100644 --- a/lib/commands/COMMAND_GETKEYS.spec.ts +++ b/lib/commands/COMMAND_GETKEYS.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './COMMAND_GETKEYS'; describe('COMMAND GETKEYS', () => { @@ -10,10 +10,10 @@ describe('COMMAND GETKEYS', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.commandGetKeys', async client => { + testUtils.testWithClient('client.commandGetKeys', async client => { assert.deepEqual( await client.commandGetKeys(['GET', 'key']), ['key'] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/COMMAND_INFO.spec.ts b/lib/commands/COMMAND_INFO.spec.ts index 59a61f6680..3b2672dcb6 100644 --- a/lib/commands/COMMAND_INFO.spec.ts +++ b/lib/commands/COMMAND_INFO.spec.ts @@ -1,7 +1,26 @@ import { strict as assert } from 'assert'; -import { itWithClient, TestRedisServers } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './COMMAND_INFO'; -import { CommandCategories, CommandFlags } from './generic-transformers'; +import { CommandCategories, CommandFlags, CommandReply } from './generic-transformers'; + +export function assertPingCommand(commandInfo: CommandReply | null | undefined): void { + assert.deepEqual( + commandInfo, + { + name: 'ping', + arity: -1, + flags: new Set([CommandFlags.STALE, CommandFlags.FAST]), + firstKeyIndex: 0, + lastKeyIndex: 0, + step: 0, + categories: new Set( + testUtils.isVersionGreaterThan([6]) ? + [CommandCategories.FAST, CommandCategories.CONNECTION] : + [] + ) + } + ); +} describe('COMMAND INFO', () => { it('transformArguments', () => { @@ -11,20 +30,7 @@ describe('COMMAND INFO', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.commandInfo', async client => { - assert.deepEqual( - await client.commandInfo(['PING']), - [{ - name: 'ping', - arity: -1, - flags: new Set([CommandFlags.STALE, CommandFlags.FAST]), - firstKeyIndex: 0, - lastKeyIndex: 0, - step: 0, - categories: new Set([CommandCategories.FAST, CommandCategories.CONNECTION]) - }] - ); - }, { - minimumRedisVersion: [6] - }); + testUtils.testWithClient('client.commandInfo', async client => { + assertPingCommand((await client.commandInfo(['PING']))[0]); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/COPY.spec.ts b/lib/commands/COPY.spec.ts index fb35be863a..0d68e969cd 100644 --- a/lib/commands/COPY.spec.ts +++ b/lib/commands/COPY.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments, transformReply } from './COPY'; describe('COPY', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); describe('transformArguments', () => { it('simple', () => { @@ -58,10 +58,10 @@ describe('COPY', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.copy', async client => { + testUtils.testWithClient('client.copy', async client => { assert.equal( await client.copy('source', 'destination'), false ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/DBSIZE.spec.ts b/lib/commands/DBSIZE.spec.ts index 36f591dbd2..a014a46e6e 100644 --- a/lib/commands/DBSIZE.spec.ts +++ b/lib/commands/DBSIZE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './DBSIZE'; describe('DBSIZE', () => { @@ -10,10 +10,10 @@ describe('DBSIZE', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.dbSize', async client => { + testUtils.testWithClient('client.dbSize', async client => { assert.equal( await client.dbSize(), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/DECR.spec.ts b/lib/commands/DECR.spec.ts index 5b4b4f0fd3..75e1205fed 100644 --- a/lib/commands/DECR.spec.ts +++ b/lib/commands/DECR.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './DECR'; describe('DECR', () => { @@ -10,10 +10,10 @@ describe('DECR', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.decr', async client => { + testUtils.testWithClient('client.decr', async client => { assert.equal( await client.decr('key'), -1 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/DECRBY.spec.ts b/lib/commands/DECRBY.spec.ts index 1c9ac69bb9..d2c23e9472 100644 --- a/lib/commands/DECRBY.spec.ts +++ b/lib/commands/DECRBY.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './DECRBY'; describe('DECRBY', () => { @@ -10,10 +10,10 @@ describe('DECRBY', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.decrBy', async client => { + testUtils.testWithClient('client.decrBy', async client => { assert.equal( await client.decrBy('key', 2), -2 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/DEL.spec.ts b/lib/commands/DEL.spec.ts index ec780de67a..75a29a8f64 100644 --- a/lib/commands/DEL.spec.ts +++ b/lib/commands/DEL.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './DEL'; describe('DEL', () => { @@ -19,10 +19,10 @@ describe('DEL', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.del', async client => { + testUtils.testWithClient('client.del', async client => { assert.equal( await client.del('key'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/DUMP.spec.ts b/lib/commands/DUMP.spec.ts index e3f42c5757..aebbf4f3f7 100644 --- a/lib/commands/DUMP.spec.ts +++ b/lib/commands/DUMP.spec.ts @@ -1,11 +1,11 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; describe('DUMP', () => { - itWithClient(TestRedisServers.OPEN, 'client.dump', async client => { + testUtils.testWithClient('client.dump', async client => { assert.equal( await client.dump('key'), null ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ECHO.spec.ts b/lib/commands/ECHO.spec.ts index d91b737395..27f6b2a17d 100644 --- a/lib/commands/ECHO.spec.ts +++ b/lib/commands/ECHO.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ECHO'; describe('ECHO', () => { @@ -10,10 +10,10 @@ describe('ECHO', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.echo', async client => { + testUtils.testWithClient('client.echo', async client => { assert.equal( await client.echo('message'), 'message' ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/EVAL.spec.ts b/lib/commands/EVAL.spec.ts index 2be1aedf08..7aa029362f 100644 --- a/lib/commands/EVAL.spec.ts +++ b/lib/commands/EVAL.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './EVAL'; describe('EVAL', () => { @@ -13,17 +13,17 @@ describe('EVAL', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.eval', async client => { + testUtils.testWithClient('client.eval', async client => { assert.equal( await client.eval('return 1'), 1 ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.eval', async cluster => { + testUtils.testWithCluster('cluster.eval', async cluster => { assert.equal( await cluster.eval('return 1'), 1 ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/EXISTS.spec.ts b/lib/commands/EXISTS.spec.ts index 3cba44b563..241a97c362 100644 --- a/lib/commands/EXISTS.spec.ts +++ b/lib/commands/EXISTS.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './EXISTS'; describe('EXISTS', () => { @@ -19,10 +19,10 @@ describe('EXISTS', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.exists', async client => { + testUtils.testWithClient('client.exists', async client => { assert.equal( await client.exists('key'), false ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/EXPIRE.spec.ts b/lib/commands/EXPIRE.spec.ts index 6550532cab..e2dc6e0312 100644 --- a/lib/commands/EXPIRE.spec.ts +++ b/lib/commands/EXPIRE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './EXPIRE'; describe('EXPIRE', () => { @@ -10,10 +10,10 @@ describe('EXPIRE', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.expire', async client => { + testUtils.testWithClient('client.expire', async client => { assert.equal( await client.expire('key', 0), false ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/EXPIREAT.spec.ts b/lib/commands/EXPIREAT.spec.ts index cefe9fa9b8..1a11af1a73 100644 --- a/lib/commands/EXPIREAT.spec.ts +++ b/lib/commands/EXPIREAT.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './EXPIREAT'; describe('EXPIREAT', () => { @@ -10,7 +10,7 @@ describe('EXPIREAT', () => { ['EXPIREAT', 'key', '1'] ); }); - + it('date', () => { const d = new Date(); assert.deepEqual( @@ -20,10 +20,10 @@ describe('EXPIREAT', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.expireAt', async client => { + testUtils.testWithClient('client.expireAt', async client => { assert.equal( await client.expireAt('key', 1), false ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/FLUSHALL.spec.ts b/lib/commands/FLUSHALL.spec.ts index 7f1c5ffd28..db5bb72e9c 100644 --- a/lib/commands/FLUSHALL.spec.ts +++ b/lib/commands/FLUSHALL.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { RedisFlushModes, transformArguments } from './FLUSHALL'; describe('FLUSHALL', () => { @@ -26,10 +26,10 @@ describe('FLUSHALL', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.flushAll', async client => { + testUtils.testWithClient('client.flushAll', async client => { assert.equal( await client.flushAll(), 'OK' ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/FLUSHDB.spec.ts b/lib/commands/FLUSHDB.spec.ts index e237e52768..bf460e9e7a 100644 --- a/lib/commands/FLUSHDB.spec.ts +++ b/lib/commands/FLUSHDB.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { RedisFlushModes } from './FLUSHALL'; import { transformArguments } from './FLUSHDB'; @@ -27,10 +27,10 @@ describe('FLUSHDB', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.flushDb', async client => { + testUtils.testWithClient('client.flushDb', async client => { assert.equal( await client.flushDb(), 'OK' ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/GEOADD.spec.ts b/lib/commands/GEOADD.spec.ts index 673e962093..6425c881c9 100644 --- a/lib/commands/GEOADD.spec.ts +++ b/lib/commands/GEOADD.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './GEOADD'; describe('GEOADD', () => { @@ -71,7 +71,7 @@ describe('GEOADD', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.geoAdd', async client => { + testUtils.testWithClient('client.geoAdd', async client => { assert.equal( await client.geoAdd('key', { member: 'member', @@ -80,9 +80,9 @@ describe('GEOADD', () => { }), 1 ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.geoAdd', async cluster => { + testUtils.testWithCluster('cluster.geoAdd', async cluster => { assert.equal( await cluster.geoAdd('key', { member: 'member', @@ -91,5 +91,5 @@ describe('GEOADD', () => { }), 1 ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/GEODIST.spec.ts b/lib/commands/GEODIST.spec.ts index 2cff8ecbd8..bbc62480ee 100644 --- a/lib/commands/GEODIST.spec.ts +++ b/lib/commands/GEODIST.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './GEODIST'; describe('GEODIST', () => { @@ -20,14 +20,14 @@ describe('GEODIST', () => { }); describe('client.geoDist', () => { - itWithClient(TestRedisServers.OPEN, 'null', async client => { + testUtils.testWithClient('null', async client => { assert.equal( await client.geoDist('key', '1', '2'), null ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithClient(TestRedisServers.OPEN, 'with value', async client => { + testUtils.testWithClient('with value', async client => { const [, dist] = await Promise.all([ client.geoAdd('key', [{ member: '1', @@ -45,13 +45,13 @@ describe('GEODIST', () => { dist, 157270.0561 ); - }); + }, GLOBAL.SERVERS.OPEN); }); - itWithCluster(TestRedisClusters.OPEN, 'cluster.geoDist', async cluster => { + testUtils.testWithCluster('cluster.geoDist', async cluster => { assert.equal( await cluster.geoDist('key', '1', '2'), null ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/GEOHASH.spec.ts b/lib/commands/GEOHASH.spec.ts index b79de23555..c421c148f4 100644 --- a/lib/commands/GEOHASH.spec.ts +++ b/lib/commands/GEOHASH.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './GEOHASH'; describe('GEOHASH', () => { @@ -19,17 +19,17 @@ describe('GEOHASH', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.geoHash', async client => { + testUtils.testWithClient('client.geoHash', async client => { assert.deepEqual( await client.geoHash('key', 'member'), [null] ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.geoHash', async cluster => { + testUtils.testWithCluster('cluster.geoHash', async cluster => { assert.deepEqual( await cluster.geoHash('key', 'member'), [null] ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/GEOPOS.spec.ts b/lib/commands/GEOPOS.spec.ts index e15abeff51..9c08ccd08f 100644 --- a/lib/commands/GEOPOS.spec.ts +++ b/lib/commands/GEOPOS.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments, transformReply } from './GEOPOS'; describe('GEOPOS', () => { @@ -39,14 +39,14 @@ describe('GEOPOS', () => { }); describe('client.geoPos', () => { - itWithClient(TestRedisServers.OPEN, 'null', async client => { + testUtils.testWithClient('null', async client => { assert.deepEqual( await client.geoPos('key', 'member'), [null] ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithClient(TestRedisServers.OPEN, 'with member', async client => { + testUtils.testWithClient('with member', async client => { const coordinates = { longitude: '-122.06429868936538696', latitude: '37.37749628831998194' @@ -61,13 +61,13 @@ describe('GEOPOS', () => { await client.geoPos('key', 'member'), [coordinates] ); - }); + }, GLOBAL.SERVERS.OPEN); }); - itWithCluster(TestRedisClusters.OPEN, 'cluster.geoPos', async cluster => { + testUtils.testWithCluster('cluster.geoPos', async cluster => { assert.deepEqual( await cluster.geoPos('key', 'member'), [null] ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/GEOSEARCH.spec.ts b/lib/commands/GEOSEARCH.spec.ts index a8606b3f74..ec0d4bcc4f 100644 --- a/lib/commands/GEOSEARCH.spec.ts +++ b/lib/commands/GEOSEARCH.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './GEOSEARCH'; describe('GEOSEARCH', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); it('transformArguments', () => { assert.deepEqual( @@ -15,7 +15,7 @@ describe('GEOSEARCH', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.geoSearch', async client => { + testUtils.testWithClient('client.geoSearch', async client => { assert.deepEqual( await client.geoSearch('key', 'member', { radius: 1, @@ -23,9 +23,9 @@ describe('GEOSEARCH', () => { }), [] ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.geoSearch', async cluster => { + testUtils.testWithCluster('cluster.geoSearch', async cluster => { assert.deepEqual( await cluster.geoSearch('key', 'member', { radius: 1, @@ -33,5 +33,5 @@ describe('GEOSEARCH', () => { }), [] ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/GEOSEARCHSTORE.spec.ts b/lib/commands/GEOSEARCHSTORE.spec.ts index ad33c62b78..eb32fa134e 100644 --- a/lib/commands/GEOSEARCHSTORE.spec.ts +++ b/lib/commands/GEOSEARCHSTORE.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments, transformReply } from './GEOSEARCHSTORE'; describe('GEOSEARCHSTORE', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); describe('transformArguments', () => { it('simple', () => { @@ -47,7 +47,7 @@ describe('GEOSEARCHSTORE', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.geoSearchStore', async client => { + testUtils.testWithClient('client.geoSearchStore', async client => { await client.geoAdd('source', { longitude: 1, latitude: 1, @@ -61,9 +61,9 @@ describe('GEOSEARCHSTORE', () => { }), 1 ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.geoSearchStore', async cluster => { + testUtils.testWithCluster('cluster.geoSearchStore', async cluster => { await cluster.geoAdd('{tag}source', { longitude: 1, latitude: 1, @@ -77,5 +77,5 @@ describe('GEOSEARCHSTORE', () => { }), 1 ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/GEOSEARCH_WITH.spec.ts b/lib/commands/GEOSEARCH_WITH.spec.ts index 922c00d719..c1f5213775 100644 --- a/lib/commands/GEOSEARCH_WITH.spec.ts +++ b/lib/commands/GEOSEARCH_WITH.spec.ts @@ -1,14 +1,14 @@ import { strict as assert } from 'assert'; +import testUtils, { GLOBAL } from '../test-utils'; import { RedisCommandArguments } from '.'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster, describeHandleMinimumRedisVersion } from '../test-utils'; import { GeoReplyWith } from './generic-transformers'; import { transformArguments } from './GEOSEARCH_WITH'; describe('GEOSEARCH WITH', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); it('transformArguments', () => { - const expectedReply: RedisCommandArguments = ['GEOSEARCH', 'key', 'FROMMEMBER', 'member', 'BYRADIUS', '1', 'm', 'WITHDIST'] + const expectedReply: RedisCommandArguments = ['GEOSEARCH', 'key', 'FROMMEMBER', 'member', 'BYRADIUS', '1', 'm', 'WITHDIST']; expectedReply.preserve = ['WITHDIST']; assert.deepEqual( @@ -20,7 +20,7 @@ describe('GEOSEARCH WITH', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.geoSearchWith', async client => { + testUtils.testWithClient('client.geoSearchWith', async client => { assert.deepEqual( await client.geoSearchWith('key', 'member', { radius: 1, @@ -28,9 +28,9 @@ describe('GEOSEARCH WITH', () => { }, [GeoReplyWith.DISTANCE]), [] ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.geoSearchWith', async cluster => { + testUtils.testWithCluster('cluster.geoSearchWith', async cluster => { assert.deepEqual( await cluster.geoSearchWith('key', 'member', { radius: 1, @@ -38,5 +38,5 @@ describe('GEOSEARCH WITH', () => { }, [GeoReplyWith.DISTANCE]), [] ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/GET.spec.ts b/lib/commands/GET.spec.ts index 303be60fe9..4c197f99a4 100644 --- a/lib/commands/GET.spec.ts +++ b/lib/commands/GET.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './GET'; describe('GET', () => { @@ -10,17 +10,17 @@ describe('GET', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.get', async client => { + testUtils.testWithClient('client.get', async client => { assert.equal( await client.get('key'), null ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.get', async cluster => { + testUtils.testWithCluster('cluster.get', async cluster => { assert.equal( await cluster.get('key'), null ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/GETBIT.spec.ts b/lib/commands/GETBIT.spec.ts index 7163b4ba25..4206084ece 100644 --- a/lib/commands/GETBIT.spec.ts +++ b/lib/commands/GETBIT.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './GETBIT'; describe('GETBIT', () => { @@ -10,17 +10,17 @@ describe('GETBIT', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.getBit', async client => { + testUtils.testWithClient('client.getBit', async client => { assert.equal( await client.getBit('key', 0), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.getBit', async cluster => { + testUtils.testWithCluster('cluster.getBit', async cluster => { assert.equal( await cluster.getBit('key', 0), 0 ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/GETDEL.spec.ts b/lib/commands/GETDEL.spec.ts index 232c08b950..db3a486696 100644 --- a/lib/commands/GETDEL.spec.ts +++ b/lib/commands/GETDEL.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './GETDEL'; describe('GETDEL', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); it('transformArguments', () => { assert.deepEqual( @@ -12,18 +12,17 @@ describe('GETDEL', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.getDel', async client => { + testUtils.testWithClient('client.getDel', async client => { assert.equal( await client.getDel('key'), null ); - }); + }, GLOBAL.SERVERS.OPEN); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.getDel', async cluster => { + testUtils.testWithCluster('cluster.getDel', async cluster => { assert.equal( await cluster.getDel('key'), null ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/GETEX.spec.ts b/lib/commands/GETEX.spec.ts index 830f12cedf..1bf86089da 100644 --- a/lib/commands/GETEX.spec.ts +++ b/lib/commands/GETEX.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './GETEX'; describe('GETEX', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); describe('transformArguments', () => { it('EX', () => { @@ -76,21 +76,21 @@ describe('GETEX', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.getEx', async client => { + testUtils.testWithClient('client.getEx', async client => { assert.equal( await client.getEx('key', { PERSIST: true }), null ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.getEx', async cluster => { + testUtils.testWithCluster('cluster.getEx', async cluster => { assert.equal( await cluster.getEx('key', { PERSIST: true }), null ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/GETRANGE.spec.ts b/lib/commands/GETRANGE.spec.ts index 726311e684..0c9dbc2c70 100644 --- a/lib/commands/GETRANGE.spec.ts +++ b/lib/commands/GETRANGE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './GETRANGE'; describe('GETRANGE', () => { @@ -10,18 +10,17 @@ describe('GETRANGE', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.getRange', async client => { + testUtils.testWithClient('client.getRange', async client => { assert.equal( await client.getRange('key', 0, -1), '' ); - }); + }, GLOBAL.SERVERS.OPEN); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.lTrim', async cluster => { + testUtils.testWithCluster('cluster.lTrim', async cluster => { assert.equal( await cluster.getRange('key', 0, -1), '' ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/GETSET.spec.ts b/lib/commands/GETSET.spec.ts index 4af5ab39ca..73fbcec57e 100644 --- a/lib/commands/GETSET.spec.ts +++ b/lib/commands/GETSET.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './GETSET'; describe('GETSET', () => { @@ -10,17 +10,17 @@ describe('GETSET', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.getSet', async client => { + testUtils.testWithClient('client.getSet', async client => { assert.equal( await client.getSet('key', 'value'), null ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.getSet', async cluster => { + testUtils.testWithCluster('cluster.getSet', async cluster => { assert.equal( await cluster.getSet('key', 'value'), null ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/GET_BUFFER.spec.ts b/lib/commands/GET_BUFFER.spec.ts index 533eb808c4..1f1a86799f 100644 --- a/lib/commands/GET_BUFFER.spec.ts +++ b/lib/commands/GET_BUFFER.spec.ts @@ -1,22 +1,22 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; describe('GET_BUFFER', () => { - itWithClient(TestRedisServers.OPEN, 'client.getBuffer', async client => { + testUtils.testWithClient('client.getBuffer', async client => { const buffer = Buffer.from('string'); await client.set('key', buffer); assert.deepEqual( buffer, await client.getBuffer('key') ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.getBuffer', async cluster => { + testUtils.testWithCluster('cluster.getBuffer', async cluster => { const buffer = Buffer.from('string'); await cluster.set('key', buffer); assert.deepEqual( buffer, await cluster.getBuffer('key') ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/HDEL.spec.ts b/lib/commands/HDEL.spec.ts index 04191f51ad..eb24bcfacb 100644 --- a/lib/commands/HDEL.spec.ts +++ b/lib/commands/HDEL.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './HDEL'; describe('HDEL', () => { @@ -19,10 +19,10 @@ describe('HDEL', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.hDel', async client => { + testUtils.testWithClient('client.hDel', async client => { assert.equal( await client.hDel('key', 'field'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/HELLO.spec.ts b/lib/commands/HELLO.spec.ts index db4604afea..12d6d98c7c 100644 --- a/lib/commands/HELLO.spec.ts +++ b/lib/commands/HELLO.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { REDIS_VERSION, TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './HELLO'; describe('HELLO', () => { - describeHandleMinimumRedisVersion([6]); + testUtils.isVersionGreaterThanHook([6]); describe('transformArguments', () => { it('simple', () => { @@ -60,20 +60,17 @@ describe('HELLO', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.hello', async client => { - assert.deepEqual( - await client.hello(), - { - server: 'redis', - version: REDIS_VERSION.join('.'), - proto: 2, - id: await client.clientId(), - mode: 'standalone', - role: 'master', - modules: [] - } - ); + testUtils.testWithClient('client.hello', async client => { + const reply = await client.hello(); + assert.equal(reply.server, 'redis'); + assert.equal(typeof reply.version, 'string'); + assert.equal(reply.proto, 2); + assert.equal(typeof reply.id, 'number'); + assert.equal(reply.mode, 'standalone'); + assert.equal(reply.role, 'master'); + assert.deepEqual(reply.modules, []); }, { - minimumRedisVersion: [6, 2] + ...GLOBAL.SERVERS.OPEN, + minimumDockerVersion: [6, 2] }); }); diff --git a/lib/commands/HEXISTS.spec.ts b/lib/commands/HEXISTS.spec.ts index 26c411c432..3764319c12 100644 --- a/lib/commands/HEXISTS.spec.ts +++ b/lib/commands/HEXISTS.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './HEXISTS'; describe('HEXISTS', () => { @@ -10,10 +10,10 @@ describe('HEXISTS', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.hExists', async client => { + testUtils.testWithClient('client.hExists', async client => { assert.equal( await client.hExists('key', 'field'), false ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/HGET.spec.ts b/lib/commands/HGET.spec.ts index c78550c517..6b6d0a3ee2 100644 --- a/lib/commands/HGET.spec.ts +++ b/lib/commands/HGET.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './HGET'; describe('HGET', () => { @@ -10,10 +10,10 @@ describe('HGET', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.hGet', async client => { + testUtils.testWithClient('client.hGet', async client => { assert.equal( await client.hGet('key', 'field'), null ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/HGETALL.spec.ts b/lib/commands/HGETALL.spec.ts index 68b51a2902..fcd1a30457 100644 --- a/lib/commands/HGETALL.spec.ts +++ b/lib/commands/HGETALL.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformReply } from './HGETALL'; describe('HGETALL', () => { @@ -32,10 +32,10 @@ describe('HGETALL', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.hGetAll', async client => { + testUtils.testWithClient('client.hGetAll', async client => { assert.deepEqual( await client.hGetAll('key'), Object.create(null) ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/HINCRBY.spec.ts b/lib/commands/HINCRBY.spec.ts index 898dfd1172..de40621792 100644 --- a/lib/commands/HINCRBY.spec.ts +++ b/lib/commands/HINCRBY.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './HINCRBY'; describe('HINCRBY', () => { @@ -10,10 +10,10 @@ describe('HINCRBY', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.hIncrBy', async client => { + testUtils.testWithClient('client.hIncrBy', async client => { assert.equal( await client.hIncrBy('key', 'field', 1), 1 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/HINCRBYFLOAT.spec.ts b/lib/commands/HINCRBYFLOAT.spec.ts index 83e87538c5..bd0147a348 100644 --- a/lib/commands/HINCRBYFLOAT.spec.ts +++ b/lib/commands/HINCRBYFLOAT.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './HINCRBYFLOAT'; describe('HINCRBYFLOAT', () => { @@ -10,10 +10,10 @@ describe('HINCRBYFLOAT', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.hIncrByFloat', async client => { + testUtils.testWithClient('client.hIncrByFloat', async client => { assert.equal( await client.hIncrByFloat('key', 'field', 1.5), '1.5' ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/HKEYS.spec.ts b/lib/commands/HKEYS.spec.ts index 12190668b0..f94538f67d 100644 --- a/lib/commands/HKEYS.spec.ts +++ b/lib/commands/HKEYS.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './HKEYS'; describe('HKEYS', () => { @@ -10,10 +10,10 @@ describe('HKEYS', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.hKeys', async client => { + testUtils.testWithClient('client.hKeys', async client => { assert.deepEqual( await client.hKeys('key'), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/HLEN.spec.ts b/lib/commands/HLEN.spec.ts index e9aaa64e6e..be9d4b13a7 100644 --- a/lib/commands/HLEN.spec.ts +++ b/lib/commands/HLEN.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './HLEN'; describe('HLEN', () => { @@ -10,10 +10,10 @@ describe('HLEN', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.hLen', async client => { + testUtils.testWithClient('client.hLen', async client => { assert.equal( await client.hLen('key'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/HMGET.spec.ts b/lib/commands/HMGET.spec.ts index 3b1c286e74..a7c934b760 100644 --- a/lib/commands/HMGET.spec.ts +++ b/lib/commands/HMGET.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './HMGET'; describe('HMGET', () => { @@ -19,10 +19,10 @@ describe('HMGET', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.hmGet', async client => { + testUtils.testWithClient('client.hmGet', async client => { assert.deepEqual( await client.hmGet('key', 'field'), [null] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/HRANDFIELD.spec.ts b/lib/commands/HRANDFIELD.spec.ts index 70e2585cf9..df0a4fc7a1 100644 --- a/lib/commands/HRANDFIELD.spec.ts +++ b/lib/commands/HRANDFIELD.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './HRANDFIELD'; describe('HRANDFIELD', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); it('transformArguments', () => { assert.deepEqual( @@ -12,10 +12,10 @@ describe('HRANDFIELD', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.hRandField', async client => { + testUtils.testWithClient('client.hRandField', async client => { assert.equal( await client.hRandField('key'), null ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/HRANDFIELD_COUNT.spec.ts b/lib/commands/HRANDFIELD_COUNT.spec.ts index 6954bd484a..4bfce0f7e2 100644 --- a/lib/commands/HRANDFIELD_COUNT.spec.ts +++ b/lib/commands/HRANDFIELD_COUNT.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './HRANDFIELD_COUNT'; describe('HRANDFIELD COUNT', () => { - describeHandleMinimumRedisVersion([6, 2, 5]); + testUtils.isVersionGreaterThanHook([6, 2, 5]); it('transformArguments', () => { assert.deepEqual( @@ -12,10 +12,10 @@ describe('HRANDFIELD COUNT', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.hRandFieldCount', async client => { + testUtils.testWithClient('client.hRandFieldCount', async client => { assert.deepEqual( await client.hRandFieldCount('key', 1), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/HRANDFIELD_COUNT_WITHVALUES.spec.ts b/lib/commands/HRANDFIELD_COUNT_WITHVALUES.spec.ts index 0c26cbc793..c4e6409a72 100644 --- a/lib/commands/HRANDFIELD_COUNT_WITHVALUES.spec.ts +++ b/lib/commands/HRANDFIELD_COUNT_WITHVALUES.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './HRANDFIELD_COUNT_WITHVALUES'; describe('HRANDFIELD COUNT WITHVALUES', () => { - describeHandleMinimumRedisVersion([6, 2, 5]); + testUtils.isVersionGreaterThanHook([6, 2, 5]); it('transformArguments', () => { assert.deepEqual( @@ -12,10 +12,10 @@ describe('HRANDFIELD COUNT WITHVALUES', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.hRandFieldCountWithValues', async client => { + testUtils.testWithClient('client.hRandFieldCountWithValues', async client => { assert.deepEqual( await client.hRandFieldCountWithValues('key', 1), Object.create(null) ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/HSCAN.spec.ts b/lib/commands/HSCAN.spec.ts index 7441dd48d5..b426763b99 100644 --- a/lib/commands/HSCAN.spec.ts +++ b/lib/commands/HSCAN.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments, transformReply } from './HSCAN'; describe('HSCAN', () => { @@ -65,7 +65,7 @@ describe('HSCAN', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.hScan', async client => { + testUtils.testWithClient('client.hScan', async client => { assert.deepEqual( await client.hScan('key', 0), { @@ -73,5 +73,5 @@ describe('HSCAN', () => { tuples: [] } ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/HSET.spec.ts b/lib/commands/HSET.spec.ts index e8dfe7865d..507c7bbbf7 100644 --- a/lib/commands/HSET.spec.ts +++ b/lib/commands/HSET.spec.ts @@ -1,6 +1,6 @@ import { strict as assert } from 'assert'; import { transformArguments } from './HSET'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; describe('HSET', () => { describe('transformArguments', () => { @@ -33,17 +33,17 @@ describe('HSET', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.hSet', async client => { + testUtils.testWithClient('client.hSet', async client => { assert.equal( await client.hSet('key', 'field', 'value'), 1 ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.hSet', async cluster => { + testUtils.testWithCluster('cluster.hSet', async cluster => { assert.equal( await cluster.hSet('key', { field: 'value' }), 1 ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); \ No newline at end of file diff --git a/lib/commands/HSETNX.spec.ts b/lib/commands/HSETNX.spec.ts index f810c5e2b9..190fa50ae9 100644 --- a/lib/commands/HSETNX.spec.ts +++ b/lib/commands/HSETNX.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './HSETNX'; describe('HSETNX', () => { @@ -10,10 +10,10 @@ describe('HSETNX', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.hSetNX', async client => { + testUtils.testWithClient('client.hSetNX', async client => { assert.equal( await client.hSetNX('key', 'field', 'value'), true ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/HSTRLEN.spec.ts b/lib/commands/HSTRLEN.spec.ts index 35bf08d54c..79c3150211 100644 --- a/lib/commands/HSTRLEN.spec.ts +++ b/lib/commands/HSTRLEN.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './HSTRLEN'; describe('HSTRLEN', () => { @@ -10,10 +10,10 @@ describe('HSTRLEN', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.hStrLen', async client => { + testUtils.testWithClient('client.hStrLen', async client => { assert.equal( await client.hStrLen('key', 'field'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/HVALS.spec.ts b/lib/commands/HVALS.spec.ts index 9e6451f500..d0a6c39ce5 100644 --- a/lib/commands/HVALS.spec.ts +++ b/lib/commands/HVALS.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './HVALS'; describe('HVALS', () => { @@ -10,10 +10,10 @@ describe('HVALS', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.hVals', async client => { + testUtils.testWithClient('client.hVals', async client => { assert.deepEqual( await client.hVals('key'), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/INCR.spec.ts b/lib/commands/INCR.spec.ts index d64c3696af..321d83edc5 100644 --- a/lib/commands/INCR.spec.ts +++ b/lib/commands/INCR.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './INCR'; describe('INCR', () => { @@ -10,10 +10,10 @@ describe('INCR', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.incr', async client => { + testUtils.testWithClient('client.incr', async client => { assert.equal( await client.incr('key'), 1 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/INCRBY.spec.ts b/lib/commands/INCRBY.spec.ts index 875277570c..a671d0ec25 100644 --- a/lib/commands/INCRBY.spec.ts +++ b/lib/commands/INCRBY.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './INCRBY'; describe('INCR', () => { @@ -10,10 +10,10 @@ describe('INCR', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.incrBy', async client => { + testUtils.testWithClient('client.incrBy', async client => { assert.equal( await client.incrBy('key', 1), 1 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/INCRBYFLOAT.spec.ts b/lib/commands/INCRBYFLOAT.spec.ts index fe062b6290..b2dd5aa5da 100644 --- a/lib/commands/INCRBYFLOAT.spec.ts +++ b/lib/commands/INCRBYFLOAT.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './INCRBYFLOAT'; describe('INCRBYFLOAT', () => { @@ -10,10 +10,10 @@ describe('INCRBYFLOAT', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.incrByFloat', async client => { + testUtils.testWithClient('client.incrByFloat', async client => { assert.equal( await client.incrByFloat('key', 1.5), '1.5' ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/KEYS.spec.ts b/lib/commands/KEYS.spec.ts index d11e8a0f58..c066331ea7 100644 --- a/lib/commands/KEYS.spec.ts +++ b/lib/commands/KEYS.spec.ts @@ -1,11 +1,11 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; describe('KEYS', () => { - itWithClient(TestRedisServers.OPEN, 'client.keys', async client => { + testUtils.testWithClient('client.keys', async client => { assert.deepEqual( await client.keys('pattern'), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/LASTSAVE.spec.ts b/lib/commands/LASTSAVE.spec.ts index b8d801f70b..a6b4863f39 100644 --- a/lib/commands/LASTSAVE.spec.ts +++ b/lib/commands/LASTSAVE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './LASTSAVE'; describe('LASTSAVE', () => { @@ -10,7 +10,7 @@ describe('LASTSAVE', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.lastSave', async client => { + testUtils.testWithClient('client.lastSave', async client => { assert.ok((await client.lastSave()) instanceof Date); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/LINDEX.spec.ts b/lib/commands/LINDEX.spec.ts index 74a6706ecd..5e0b1473ec 100644 --- a/lib/commands/LINDEX.spec.ts +++ b/lib/commands/LINDEX.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './LINDEX'; describe('LINDEX', () => { @@ -10,17 +10,17 @@ describe('LINDEX', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.lIndex', async client => { + testUtils.testWithClient('client.lIndex', async client => { assert.equal( await client.lIndex('key', 'element'), null ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.lIndex', async cluster => { + testUtils.testWithCluster('cluster.lIndex', async cluster => { assert.equal( await cluster.lIndex('key', 'element'), null ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/LINSERT.spec.ts b/lib/commands/LINSERT.spec.ts index 286e61d06d..6cc429d6a2 100644 --- a/lib/commands/LINSERT.spec.ts +++ b/lib/commands/LINSERT.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './LINSERT'; describe('LINSERT', () => { @@ -10,17 +10,17 @@ describe('LINSERT', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.lInsert', async client => { + testUtils.testWithClient('client.lInsert', async client => { assert.equal( await client.lInsert('key', 'BEFORE', 'pivot', 'element'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.lLen', async cluster => { + testUtils.testWithCluster('cluster.lLen', async cluster => { assert.equal( await cluster.lInsert('key', 'BEFORE', 'pivot', 'element'), 0 ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/LLEN.spec.ts b/lib/commands/LLEN.spec.ts index 6e4581ddd1..fb126ddad5 100644 --- a/lib/commands/LLEN.spec.ts +++ b/lib/commands/LLEN.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './LLEN'; describe('LLEN', () => { @@ -10,17 +10,17 @@ describe('LLEN', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.lLen', async client => { + testUtils.testWithClient('client.lLen', async client => { assert.equal( await client.lLen('key'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.lLen', async cluster => { + testUtils.testWithCluster('cluster.lLen', async cluster => { assert.equal( await cluster.lLen('key'), 0 ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/LMOVE.spec.ts b/lib/commands/LMOVE.spec.ts index bcb897f76a..f1d418c394 100644 --- a/lib/commands/LMOVE.spec.ts +++ b/lib/commands/LMOVE.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './LMOVE'; describe('LMOVE', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); it('transformArguments', () => { assert.deepEqual( @@ -12,17 +12,17 @@ describe('LMOVE', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.lMove', async client => { + testUtils.testWithClient('client.lMove', async client => { assert.equal( await client.lMove('source', 'destination', 'LEFT', 'RIGHT'), null ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.lMove', async cluster => { + testUtils.testWithCluster('cluster.lMove', async cluster => { assert.equal( await cluster.lMove('{tag}source', '{tag}destination', 'LEFT', 'RIGHT'), null ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/LOLWUT.spec.ts b/lib/commands/LOLWUT.spec.ts index 8f4478aecc..db33589330 100644 --- a/lib/commands/LOLWUT.spec.ts +++ b/lib/commands/LOLWUT.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './LOLWUT'; describe('LOLWUT', () => { @@ -26,11 +26,10 @@ describe('LOLWUT', () => { }); }); - - itWithClient(TestRedisServers.OPEN, 'client.LOLWUT', async client => { + testUtils.testWithClient('client.LOLWUT', async client => { assert.equal( typeof (await client.LOLWUT()), 'string' ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/LPOP.spec.ts b/lib/commands/LPOP.spec.ts index b593f65742..d694fb1058 100644 --- a/lib/commands/LPOP.spec.ts +++ b/lib/commands/LPOP.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './LPOP'; describe('LPOP', () => { @@ -10,17 +10,17 @@ describe('LPOP', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.lPop', async client => { + testUtils.testWithClient('client.lPop', async client => { assert.equal( await client.lPop('key'), null ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.lPop', async cluster => { + testUtils.testWithCluster('cluster.lPop', async cluster => { assert.equal( await cluster.lPop('key'), null ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/LPOP_COUNT.spec.ts b/lib/commands/LPOP_COUNT.spec.ts index 89150dbf4d..9d87fad386 100644 --- a/lib/commands/LPOP_COUNT.spec.ts +++ b/lib/commands/LPOP_COUNT.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './LPOP_COUNT'; describe('LPOP COUNT', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); it('transformArguments', () => { assert.deepEqual( @@ -12,17 +12,17 @@ describe('LPOP COUNT', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.lPopCount', async client => { + testUtils.testWithClient('client.lPopCount', async client => { assert.equal( await client.lPopCount('key', 1), null ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.lPop', async cluster => { + testUtils.testWithCluster('cluster.lPopCount', async cluster => { assert.equal( await cluster.lPopCount('key', 1), null ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/LPOS.spec.ts b/lib/commands/LPOS.spec.ts index 1cf9e35209..6b6050f2c3 100644 --- a/lib/commands/LPOS.spec.ts +++ b/lib/commands/LPOS.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './LPOS'; describe('LPOS', () => { - describeHandleMinimumRedisVersion([6, 0, 6]); + testUtils.isVersionGreaterThanHook([6, 0, 6]); describe('transformArguments', () => { it('simple', () => { @@ -42,17 +42,17 @@ describe('LPOS', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.lPos', async client => { + testUtils.testWithClient('client.lPos', async client => { assert.equal( await client.lPos('key', 'element'), null ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.lPos', async cluster => { + testUtils.testWithCluster('cluster.lPos', async cluster => { assert.equal( await cluster.lPos('key', 'element'), null ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/LPOS_COUNT.spec.ts b/lib/commands/LPOS_COUNT.spec.ts index 1d80bd45c3..4b01f2f59b 100644 --- a/lib/commands/LPOS_COUNT.spec.ts +++ b/lib/commands/LPOS_COUNT.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './LPOS_COUNT'; describe('LPOS COUNT', () => { - describeHandleMinimumRedisVersion([6, 0, 6]); + testUtils.isVersionGreaterThanHook([6, 0, 6]); describe('transformArguments', () => { it('simple', () => { @@ -42,17 +42,17 @@ describe('LPOS COUNT', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.lPosCount', async client => { + testUtils.testWithClient('client.lPosCount', async client => { assert.deepEqual( await client.lPosCount('key', 'element', 0), [] ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.lPosCount', async cluster => { + testUtils.testWithCluster('cluster.lPosCount', async cluster => { assert.deepEqual( await cluster.lPosCount('key', 'element', 0), [] ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/LPUSH.spec.ts b/lib/commands/LPUSH.spec.ts index 44cf8c12d5..b5b1f5084e 100644 --- a/lib/commands/LPUSH.spec.ts +++ b/lib/commands/LPUSH.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './LPUSH'; describe('LPUSH', () => { @@ -19,17 +19,17 @@ describe('LPUSH', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.lPush', async client => { + testUtils.testWithClient('client.lPush', async client => { assert.equal( await client.lPush('key', 'field'), 1 ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.lPush', async cluster => { + testUtils.testWithCluster('cluster.lPush', async cluster => { assert.equal( await cluster.lPush('key', 'field'), 1 ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/LPUSHX.spec.ts b/lib/commands/LPUSHX.spec.ts index 1150c4d64d..d978e5a588 100644 --- a/lib/commands/LPUSHX.spec.ts +++ b/lib/commands/LPUSHX.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './LPUSHX'; describe('LPUSHX', () => { @@ -19,17 +19,17 @@ describe('LPUSHX', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.lPushX', async client => { + testUtils.testWithClient('client.lPushX', async client => { assert.equal( await client.lPushX('key', 'element'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.lPushX', async cluster => { + testUtils.testWithCluster('cluster.lPushX', async cluster => { assert.equal( await cluster.lPushX('key', 'element'), 0 ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/LRANGE.spec.ts b/lib/commands/LRANGE.spec.ts index 843b7b8815..dffe6087b8 100644 --- a/lib/commands/LRANGE.spec.ts +++ b/lib/commands/LRANGE.spec.ts @@ -1,6 +1,6 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './LRANGE'; describe('LRANGE', () => { @@ -11,17 +11,17 @@ describe('LRANGE', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.lRange', async client => { + testUtils.testWithClient('client.lRange', async client => { assert.deepEqual( await client.lRange('key', 0, -1), [] ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.lRange', async cluster => { + testUtils.testWithCluster('cluster.lRange', async cluster => { assert.deepEqual( await cluster.lRange('key', 0, -1), [] ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/LREM.spec.ts b/lib/commands/LREM.spec.ts index e2f027ffeb..3405f4beb0 100644 --- a/lib/commands/LREM.spec.ts +++ b/lib/commands/LREM.spec.ts @@ -1,6 +1,6 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './LREM'; describe('LREM', () => { @@ -11,17 +11,17 @@ describe('LREM', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.lRem', async client => { + testUtils.testWithClient('client.lRem', async client => { assert.equal( await client.lRem('key', 0, 'element'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.lRem', async cluster => { + testUtils.testWithCluster('cluster.lRem', async cluster => { assert.equal( await cluster.lRem('key', 0, 'element'), 0 ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/LSET.spec.ts b/lib/commands/LSET.spec.ts index a5fe78cf4c..d7241032cc 100644 --- a/lib/commands/LSET.spec.ts +++ b/lib/commands/LSET.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './LSET'; describe('LSET', () => { @@ -10,19 +10,19 @@ describe('LSET', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.lSet', async client => { + testUtils.testWithClient('client.lSet', async client => { await client.lPush('key', 'element'); assert.equal( await client.lSet('key', 0, 'element'), 'OK' ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.lSet', async cluster => { + testUtils.testWithCluster('cluster.lSet', async cluster => { await cluster.lPush('key', 'element'); assert.equal( await cluster.lSet('key', 0, 'element'), 'OK' ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/LTRIM.spec.ts b/lib/commands/LTRIM.spec.ts index 8092ba6af1..5b6ac5d366 100644 --- a/lib/commands/LTRIM.spec.ts +++ b/lib/commands/LTRIM.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './LTRIM'; describe('LTRIM', () => { @@ -10,17 +10,17 @@ describe('LTRIM', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.lTrim', async client => { + testUtils.testWithClient('client.lTrim', async client => { assert.equal( await client.lTrim('key', 0, -1), 'OK' ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.lTrim', async cluster => { + testUtils.testWithCluster('cluster.lTrim', async cluster => { assert.equal( await cluster.lTrim('key', 0, -1), 'OK' ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/LTRIM.ts b/lib/commands/LTRIM.ts index 018afd90a1..ab78e5305a 100644 --- a/lib/commands/LTRIM.ts +++ b/lib/commands/LTRIM.ts @@ -6,7 +6,7 @@ export function transformArguments(key: string, start: number, stop: number): Ar key, start.toString(), stop.toString() - ] + ]; } export declare function transformReply(): string; diff --git a/lib/commands/MEMORY_DOCTOR.spec.ts b/lib/commands/MEMORY_DOCTOR.spec.ts index 1b4d16fa0d..ad97047606 100644 --- a/lib/commands/MEMORY_DOCTOR.spec.ts +++ b/lib/commands/MEMORY_DOCTOR.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './MEMORY_DOCTOR'; describe('MEMORY DOCTOR', () => { @@ -10,10 +10,10 @@ describe('MEMORY DOCTOR', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.memoryDoctor', async client => { + testUtils.testWithClient('client.memoryDoctor', async client => { assert.equal( typeof (await client.memoryDoctor()), 'string' ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/MEMORY_MALLOC-STATS.spec.ts b/lib/commands/MEMORY_MALLOC-STATS.spec.ts index 034b94f7c6..ce866f1e11 100644 --- a/lib/commands/MEMORY_MALLOC-STATS.spec.ts +++ b/lib/commands/MEMORY_MALLOC-STATS.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './MEMORY_MALLOC-STATS'; describe('MEMORY MALLOC-STATS', () => { @@ -10,10 +10,10 @@ describe('MEMORY MALLOC-STATS', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.memoryMallocStats', async client => { + testUtils.testWithClient('client.memoryMallocStats', async client => { assert.equal( typeof (await client.memoryDoctor()), 'string' ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/MEMORY_PURGE.spec.ts b/lib/commands/MEMORY_PURGE.spec.ts index 97ca6feebf..5d34331feb 100644 --- a/lib/commands/MEMORY_PURGE.spec.ts +++ b/lib/commands/MEMORY_PURGE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './MEMORY_PURGE'; describe('MEMORY PURGE', () => { @@ -10,10 +10,10 @@ describe('MEMORY PURGE', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.memoryPurge', async client => { + testUtils.testWithClient('client.memoryPurge', async client => { assert.equal( await client.memoryPurge(), 'OK' ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/MEMORY_USAGE.spec.ts b/lib/commands/MEMORY_USAGE.spec.ts index 90dff62c67..fe5ff404d9 100644 --- a/lib/commands/MEMORY_USAGE.spec.ts +++ b/lib/commands/MEMORY_USAGE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './MEMORY_USAGE'; describe('MEMORY USAGE', () => { @@ -21,10 +21,10 @@ describe('MEMORY USAGE', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.memoryUsage', async client => { + testUtils.testWithClient('client.memoryUsage', async client => { assert.equal( await client.memoryUsage('key'), null ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/MGET.spec.ts b/lib/commands/MGET.spec.ts index c8c020fe43..9ff47895f4 100644 --- a/lib/commands/MGET.spec.ts +++ b/lib/commands/MGET.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './MGET'; describe('MGET', () => { @@ -10,17 +10,17 @@ describe('MGET', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.mGet', async client => { + testUtils.testWithClient('client.mGet', async client => { assert.deepEqual( await client.mGet(['key']), [null] ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.mGet', async cluster => { + testUtils.testWithCluster('cluster.mGet', async cluster => { assert.deepEqual( await cluster.mGet(['key']), [null] ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/MOVE.spec.ts b/lib/commands/MOVE.spec.ts index a05ca4613e..f7fdc481cb 100644 --- a/lib/commands/MOVE.spec.ts +++ b/lib/commands/MOVE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './MOVE'; describe('MOVE', () => { @@ -10,10 +10,10 @@ describe('MOVE', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.move', async client => { + testUtils.testWithClient('client.move', async client => { assert.equal( await client.move('key', 1), false ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/MSET.spec.ts b/lib/commands/MSET.spec.ts index 4445f4a728..0568f38487 100644 --- a/lib/commands/MSET.spec.ts +++ b/lib/commands/MSET.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './MSET'; describe('MSET', () => { @@ -26,17 +26,17 @@ describe('MSET', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.mSet', async client => { + testUtils.testWithClient('client.mSet', async client => { assert.equal( await client.mSet(['key1', 'value1', 'key2', 'value2']), 'OK' ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.mSet', async cluster => { + testUtils.testWithCluster('cluster.mSet', async cluster => { assert.equal( await cluster.mSet(['{key}1', 'value1', '{key}2', 'value2']), 'OK' ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/MSETNX.spec.ts b/lib/commands/MSETNX.spec.ts index 7f61a43e8d..854a9affd8 100644 --- a/lib/commands/MSETNX.spec.ts +++ b/lib/commands/MSETNX.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './MSETNX'; describe('MSETNX', () => { @@ -26,17 +26,17 @@ describe('MSETNX', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.mSetNX', async client => { + testUtils.testWithClient('client.mSetNX', async client => { assert.equal( await client.mSetNX(['key1', 'value1', 'key2', 'value2']), true ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.mSetNX', async cluster => { + testUtils.testWithCluster('cluster.mSetNX', async cluster => { assert.equal( await cluster.mSetNX(['{key}1', 'value1', '{key}2', 'value2']), true ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/PERSIST.spec.ts b/lib/commands/PERSIST.spec.ts index 05c0e7aed8..4e53bd85a6 100644 --- a/lib/commands/PERSIST.spec.ts +++ b/lib/commands/PERSIST.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './PERSIST'; describe('PERSIST', () => { @@ -10,10 +10,10 @@ describe('PERSIST', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.persist', async client => { + testUtils.testWithClient('client.persist', async client => { assert.equal( await client.persist('key'), false ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/PEXPIRE.spec.ts b/lib/commands/PEXPIRE.spec.ts index b7c4e1df46..4738edcf8f 100644 --- a/lib/commands/PEXPIRE.spec.ts +++ b/lib/commands/PEXPIRE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './PEXPIRE'; describe('PEXPIRE', () => { @@ -10,10 +10,10 @@ describe('PEXPIRE', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.pExpire', async client => { + testUtils.testWithClient('client.pExpire', async client => { assert.equal( await client.pExpire('key', 1), false ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/PEXPIREAT.spec.ts b/lib/commands/PEXPIREAT.spec.ts index 6e5fc37ed5..19fc3b888d 100644 --- a/lib/commands/PEXPIREAT.spec.ts +++ b/lib/commands/PEXPIREAT.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './PEXPIREAT'; describe('PEXPIREAT', () => { @@ -10,7 +10,7 @@ describe('PEXPIREAT', () => { ['PEXPIREAT', 'key', '1'] ); }); - + it('date', () => { const d = new Date(); assert.deepEqual( @@ -20,10 +20,10 @@ describe('PEXPIREAT', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.pExpireAt', async client => { + testUtils.testWithClient('client.pExpireAt', async client => { assert.equal( await client.pExpireAt('key', 1), false ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/PFADD.spec.ts b/lib/commands/PFADD.spec.ts index 74f03ea3ce..8c0e752fd5 100644 --- a/lib/commands/PFADD.spec.ts +++ b/lib/commands/PFADD.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './PFADD'; describe('PFADD', () => { @@ -19,10 +19,10 @@ describe('PFADD', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.pfAdd', async client => { + testUtils.testWithClient('client.pfAdd', async client => { assert.equal( await client.pfAdd('key', '1'), true ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/PFCOUNT.spec.ts b/lib/commands/PFCOUNT.spec.ts index 049fa2c200..a1ea06c449 100644 --- a/lib/commands/PFCOUNT.spec.ts +++ b/lib/commands/PFCOUNT.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './PFCOUNT'; describe('PFCOUNT', () => { @@ -19,10 +19,10 @@ describe('PFCOUNT', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.pfCount', async client => { + testUtils.testWithClient('client.pfCount', async client => { assert.equal( await client.pfCount('key'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/PFMERGE.spec.ts b/lib/commands/PFMERGE.spec.ts index 1f6ed24bcd..881fc5f543 100644 --- a/lib/commands/PFMERGE.spec.ts +++ b/lib/commands/PFMERGE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './PFMERGE'; describe('PFMERGE', () => { @@ -19,10 +19,10 @@ describe('PFMERGE', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.pfMerge', async client => { + testUtils.testWithClient('client.pfMerge', async client => { assert.equal( await client.pfMerge('destination', 'source'), 'OK' ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/PING.spec.ts b/lib/commands/PING.spec.ts index 43b683f192..85b48fec6b 100644 --- a/lib/commands/PING.spec.ts +++ b/lib/commands/PING.spec.ts @@ -1,11 +1,11 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; describe('PING', () => { - itWithClient(TestRedisServers.OPEN, 'client.ping', async client => { + testUtils.testWithClient('client.ping', async client => { assert.equal( await client.ping(), 'PONG' ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/PSETEX.spec.ts b/lib/commands/PSETEX.spec.ts index c98142effa..61a6e682b0 100644 --- a/lib/commands/PSETEX.spec.ts +++ b/lib/commands/PSETEX.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './PSETEX'; describe('PSETEX', () => { @@ -10,17 +10,17 @@ describe('PSETEX', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.pSetEx', async client => { + testUtils.testWithClient('client.pSetEx', async client => { assert.equal( await client.pSetEx('key', 1, 'value'), 'OK' ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.pSetEx', async cluster => { + testUtils.testWithCluster('cluster.pSetEx', async cluster => { assert.equal( await cluster.pSetEx('key', 1, 'value'), 'OK' ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/PTTL.spec.ts b/lib/commands/PTTL.spec.ts index 35f48c2cc3..e65421de59 100644 --- a/lib/commands/PTTL.spec.ts +++ b/lib/commands/PTTL.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './PTTL'; describe('PTTL', () => { @@ -10,10 +10,10 @@ describe('PTTL', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.pTTL', async client => { + testUtils.testWithClient('client.pTTL', async client => { assert.equal( await client.pTTL('key'), -2 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/PUBLISH.spec.ts b/lib/commands/PUBLISH.spec.ts index e746b9490e..b2084e668b 100644 --- a/lib/commands/PUBLISH.spec.ts +++ b/lib/commands/PUBLISH.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './PUBLISH'; describe('PUBLISH', () => { @@ -10,10 +10,10 @@ describe('PUBLISH', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.publish', async client => { + testUtils.testWithClient('client.publish', async client => { assert.equal( await client.publish('channel', 'message'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/PUBSUB_CHANNELS.spec.ts b/lib/commands/PUBSUB_CHANNELS.spec.ts index 9e148bc7fd..c427eab485 100644 --- a/lib/commands/PUBSUB_CHANNELS.spec.ts +++ b/lib/commands/PUBSUB_CHANNELS.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './PUBSUB_CHANNELS'; describe('PUBSUB CHANNELS', () => { @@ -19,10 +19,10 @@ describe('PUBSUB CHANNELS', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.pubSubChannels', async client => { + testUtils.testWithClient('client.pubSubChannels', async client => { assert.deepEqual( await client.pubSubChannels(), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/PUBSUB_NUMPAT.spec.ts b/lib/commands/PUBSUB_NUMPAT.spec.ts index 55eef6a97d..d738b916c6 100644 --- a/lib/commands/PUBSUB_NUMPAT.spec.ts +++ b/lib/commands/PUBSUB_NUMPAT.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './PUBSUB_NUMPAT'; describe('PUBSUB NUMPAT', () => { @@ -10,10 +10,10 @@ describe('PUBSUB NUMPAT', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.pubSubNumPat', async client => { + testUtils.testWithClient('client.pubSubNumPat', async client => { assert.equal( await client.pubSubNumPat(), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/PUBSUB_NUMSUB.spec.ts b/lib/commands/PUBSUB_NUMSUB.spec.ts index ef44faf2c0..e35558ef86 100644 --- a/lib/commands/PUBSUB_NUMSUB.spec.ts +++ b/lib/commands/PUBSUB_NUMSUB.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './PUBSUB_NUMSUB'; describe('PUBSUB NUMSUB', () => { @@ -26,10 +26,10 @@ describe('PUBSUB NUMSUB', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.pubSubNumSub', async client => { + testUtils.testWithClient('client.pubSubNumSub', async client => { assert.deepEqual( await client.pubSubNumSub(), Object.create(null) ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/RANDOMKEY.spec.ts b/lib/commands/RANDOMKEY.spec.ts index 171c42be11..81c42b2fd8 100644 --- a/lib/commands/RANDOMKEY.spec.ts +++ b/lib/commands/RANDOMKEY.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './RANDOMKEY'; describe('RANDOMKEY', () => { @@ -10,10 +10,10 @@ describe('RANDOMKEY', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.randomKey', async client => { + testUtils.testWithClient('client.randomKey', async client => { assert.equal( await client.randomKey(), null ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/RENAME.spec.ts b/lib/commands/RENAME.spec.ts index 9d447c600b..49e0af600f 100644 --- a/lib/commands/RENAME.spec.ts +++ b/lib/commands/RENAME.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './RENAME'; describe('RENAME', () => { @@ -10,12 +10,12 @@ describe('RENAME', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.rename', async client => { + testUtils.testWithClient('client.rename', async client => { await client.set('from', 'value'); assert.equal( await client.rename('from', 'to'), 'OK' ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/RENAMENX.spec.ts b/lib/commands/RENAMENX.spec.ts index f438834b90..6345eb5bd0 100644 --- a/lib/commands/RENAMENX.spec.ts +++ b/lib/commands/RENAMENX.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './RENAMENX'; describe('RENAMENX', () => { @@ -10,12 +10,12 @@ describe('RENAMENX', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.renameNX', async client => { + testUtils.testWithClient('client.renameNX', async client => { await client.set('from', 'value'); assert.equal( await client.renameNX('from', 'to'), true ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ROLE.spec.ts b/lib/commands/ROLE.spec.ts index 5b647e07ca..2e6d9b163a 100644 --- a/lib/commands/ROLE.spec.ts +++ b/lib/commands/ROLE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { itWithClient, TestRedisServers } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments, transformReply } from './ROLE'; describe('ROLE', () => { @@ -56,7 +56,7 @@ describe('ROLE', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.role', async client => { + testUtils.testWithClient('client.role', async client => { assert.deepEqual( await client.role(), { @@ -65,5 +65,5 @@ describe('ROLE', () => { replicas: [] } ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/RPOP.spec.ts b/lib/commands/RPOP.spec.ts index 2a753ff1a6..6e57afa321 100644 --- a/lib/commands/RPOP.spec.ts +++ b/lib/commands/RPOP.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './RPOP'; describe('RPOP', () => { @@ -10,17 +10,17 @@ describe('RPOP', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.rPop', async client => { + testUtils.testWithClient('client.rPop', async client => { assert.equal( await client.rPop('key'), null ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.rPop', async cluster => { + testUtils.testWithCluster('cluster.rPop', async cluster => { assert.equal( await cluster.rPop('key'), null ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/RPOPLPUSH.spec.ts b/lib/commands/RPOPLPUSH.spec.ts index 75b5f2e18f..cef3049bd9 100644 --- a/lib/commands/RPOPLPUSH.spec.ts +++ b/lib/commands/RPOPLPUSH.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './RPOPLPUSH'; describe('RPOPLPUSH', () => { @@ -10,17 +10,17 @@ describe('RPOPLPUSH', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.rPopLPush', async client => { + testUtils.testWithClient('client.rPopLPush', async client => { assert.equal( await client.rPopLPush('source', 'destination'), null ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.rPopLPush', async cluster => { + testUtils.testWithCluster('cluster.rPopLPush', async cluster => { assert.equal( await cluster.rPopLPush('{tag}source', '{tag}destination'), null ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/RPOP_COUNT.spec.ts b/lib/commands/RPOP_COUNT.spec.ts index 2624540f12..3657a60803 100644 --- a/lib/commands/RPOP_COUNT.spec.ts +++ b/lib/commands/RPOP_COUNT.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './RPOP_COUNT'; describe('RPOP COUNT', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); it('transformArguments', () => { assert.deepEqual( @@ -12,17 +12,17 @@ describe('RPOP COUNT', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.rPopCount', async client => { + testUtils.testWithClient('client.rPopCount', async client => { assert.equal( await client.rPopCount('key', 1), null ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.rPopCount', async cluster => { + testUtils.testWithCluster('cluster.rPopCount', async cluster => { assert.equal( await cluster.rPopCount('key', 1), null ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/RPUSH.spec.ts b/lib/commands/RPUSH.spec.ts index 4336d10c9a..afa5c1c640 100644 --- a/lib/commands/RPUSH.spec.ts +++ b/lib/commands/RPUSH.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './RPUSH'; describe('RPUSH', () => { @@ -19,17 +19,17 @@ describe('RPUSH', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.rPush', async client => { + testUtils.testWithClient('client.rPush', async client => { assert.equal( await client.rPush('key', 'element'), 1 ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.rPush', async cluster => { + testUtils.testWithCluster('cluster.rPush', async cluster => { assert.equal( await cluster.rPush('key', 'element'), 1 ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/RPUSHX.spec.ts b/lib/commands/RPUSHX.spec.ts index 18f91e8bef..ee2041de6f 100644 --- a/lib/commands/RPUSHX.spec.ts +++ b/lib/commands/RPUSHX.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './RPUSHX'; describe('RPUSHX', () => { @@ -19,17 +19,17 @@ describe('RPUSHX', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.rPushX', async client => { + testUtils.testWithClient('client.rPushX', async client => { assert.equal( await client.rPushX('key', 'element'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.rPushX', async cluster => { + testUtils.testWithCluster('cluster.rPushX', async cluster => { assert.equal( await cluster.rPushX('key', 'element'), 0 ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/SADD.spec.ts b/lib/commands/SADD.spec.ts index bf1ee48fe7..4533f6f9ad 100644 --- a/lib/commands/SADD.spec.ts +++ b/lib/commands/SADD.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SADD'; describe('SADD', () => { @@ -19,10 +19,10 @@ describe('SADD', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.sAdd', async client => { + testUtils.testWithClient('client.sAdd', async client => { assert.equal( await client.sAdd('key', 'member'), 1 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/SCAN.spec.ts b/lib/commands/SCAN.spec.ts index 975c4cb6d2..7657b744e0 100644 --- a/lib/commands/SCAN.spec.ts +++ b/lib/commands/SCAN.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments, transformReply } from './SCAN'; describe('SCAN', () => { @@ -72,7 +72,7 @@ describe('SCAN', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.scan', async client => { + testUtils.testWithClient('client.scan', async client => { assert.deepEqual( await client.scan(0), { @@ -80,5 +80,5 @@ describe('SCAN', () => { keys: [] } ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/SCARD.spec.ts b/lib/commands/SCARD.spec.ts index b668169381..afc21c6b00 100644 --- a/lib/commands/SCARD.spec.ts +++ b/lib/commands/SCARD.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SCARD'; describe('SCARD', () => { @@ -10,10 +10,10 @@ describe('SCARD', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.sCard', async client => { + testUtils.testWithClient('client.sCard', async client => { assert.equal( await client.sCard('key'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/SCRIPT_DEBUG.spec.ts b/lib/commands/SCRIPT_DEBUG.spec.ts index 9d2ad1af26..192f90f75a 100644 --- a/lib/commands/SCRIPT_DEBUG.spec.ts +++ b/lib/commands/SCRIPT_DEBUG.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SCRIPT_DEBUG'; describe('SCRIPT DEBUG', () => { @@ -10,10 +10,10 @@ describe('SCRIPT DEBUG', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.scriptDebug', async client => { + testUtils.testWithClient('client.scriptDebug', async client => { assert.equal( await client.scriptDebug('NO'), 'OK' ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/SCRIPT_EXISTS.spec.ts b/lib/commands/SCRIPT_EXISTS.spec.ts index b23380c757..e0fbbcc553 100644 --- a/lib/commands/SCRIPT_EXISTS.spec.ts +++ b/lib/commands/SCRIPT_EXISTS.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SCRIPT_EXISTS'; describe('SCRIPT EXISTS', () => { @@ -19,10 +19,10 @@ describe('SCRIPT EXISTS', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.scriptExists', async client => { + testUtils.testWithClient('client.scriptExists', async client => { assert.deepEqual( await client.scriptExists('sha1'), [false] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/SCRIPT_FLUSH.spec.ts b/lib/commands/SCRIPT_FLUSH.spec.ts index c77accb50a..ae156e937d 100644 --- a/lib/commands/SCRIPT_FLUSH.spec.ts +++ b/lib/commands/SCRIPT_FLUSH.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SCRIPT_FLUSH'; describe('SCRIPT FLUSH', () => { @@ -19,10 +19,10 @@ describe('SCRIPT FLUSH', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.scriptFlush', async client => { + testUtils.testWithClient('client.scriptFlush', async client => { assert.equal( await client.scriptFlush(), 'OK' ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/SCRIPT_LOAD.spec.ts b/lib/commands/SCRIPT_LOAD.spec.ts index 1d7da3e9c2..062f3c201e 100644 --- a/lib/commands/SCRIPT_LOAD.spec.ts +++ b/lib/commands/SCRIPT_LOAD.spec.ts @@ -1,6 +1,6 @@ import { strict as assert } from 'assert'; import { scriptSha1 } from '../lua-script'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SCRIPT_LOAD'; describe('SCRIPT LOAD', () => { @@ -14,10 +14,10 @@ describe('SCRIPT LOAD', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.scriptLoad', async client => { + testUtils.testWithClient('client.scriptLoad', async client => { assert.equal( await client.scriptLoad(SCRIPT), SCRIPT_SHA1 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/SDIFF.spec.ts b/lib/commands/SDIFF.spec.ts index 82ef2dac6f..340906e935 100644 --- a/lib/commands/SDIFF.spec.ts +++ b/lib/commands/SDIFF.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SDIFF'; describe('SDIFF', () => { @@ -19,10 +19,10 @@ describe('SDIFF', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.sDiff', async client => { + testUtils.testWithClient('client.sDiff', async client => { assert.deepEqual( await client.sDiff('key'), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/SDIFFSTORE.spec.ts b/lib/commands/SDIFFSTORE.spec.ts index 1e7f5f6f32..263b4f43f6 100644 --- a/lib/commands/SDIFFSTORE.spec.ts +++ b/lib/commands/SDIFFSTORE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SDIFFSTORE'; describe('SDIFFSTORE', () => { @@ -19,10 +19,10 @@ describe('SDIFFSTORE', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.sDiffStore', async client => { + testUtils.testWithClient('client.sDiffStore', async client => { assert.equal( await client.sDiffStore('destination', 'key'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/SET.spec.ts b/lib/commands/SET.spec.ts index 32d138f292..353885a309 100644 --- a/lib/commands/SET.spec.ts +++ b/lib/commands/SET.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SET'; describe('SET', () => { @@ -100,14 +100,14 @@ describe('SET', () => { }); describe('client.set', () => { - itWithClient(TestRedisServers.OPEN, 'simple', async client => { + testUtils.testWithClient('simple', async client => { assert.equal( await client.set('key', 'value'), 'OK' ); - }); - - itWithClient(TestRedisServers.OPEN, 'with GET on empty key', async client => { + }, GLOBAL.SERVERS.OPEN); + + testUtils.testWithClient('with GET on empty key', async client => { assert.equal( await client.set('key', 'value', { GET: true @@ -115,7 +115,8 @@ describe('SET', () => { null ); }, { - minimumRedisVersion: [6, 2] + ...GLOBAL.SERVERS.OPEN, + minimumDockerVersion: [6, 2] }); }); }); diff --git a/lib/commands/SETBIT.spec.ts b/lib/commands/SETBIT.spec.ts index 7347913f29..43fbff7c2d 100644 --- a/lib/commands/SETBIT.spec.ts +++ b/lib/commands/SETBIT.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SETBIT'; describe('SETBIT', () => { @@ -10,17 +10,17 @@ describe('SETBIT', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.setBit', async client => { + testUtils.testWithClient('client.setBit', async client => { assert.equal( await client.setBit('key', 0, 1), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.setBit', async cluster => { + testUtils.testWithCluster('cluster.setBit', async cluster => { assert.equal( await cluster.setBit('key', 0, 1), 0 ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/SETEX.spec.ts b/lib/commands/SETEX.spec.ts index 7ea55eba83..bca298c6c0 100644 --- a/lib/commands/SETEX.spec.ts +++ b/lib/commands/SETEX.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SETEX'; describe('SETEX', () => { @@ -10,17 +10,17 @@ describe('SETEX', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.setEx', async client => { + testUtils.testWithClient('client.setEx', async client => { assert.equal( await client.setEx('key', 1, 'value'), 'OK' ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.setEx', async cluster => { + testUtils.testWithCluster('cluster.setEx', async cluster => { assert.equal( await cluster.setEx('key', 1, 'value'), 'OK' ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/SETNX .spec.ts b/lib/commands/SETNX .spec.ts index daf3ca6e76..c5bdfcffa2 100644 --- a/lib/commands/SETNX .spec.ts +++ b/lib/commands/SETNX .spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SETNX'; describe('SETNX', () => { @@ -10,17 +10,17 @@ describe('SETNX', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.setNX', async client => { + testUtils.testWithClient('client.setNX', async client => { assert.equal( await client.setNX('key', 'value'), true ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.setNX', async cluster => { + testUtils.testWithCluster('cluster.setNX', async cluster => { assert.equal( await cluster.setNX('key', 'value'), true ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/SETRANGE.spec.ts b/lib/commands/SETRANGE.spec.ts index 766c56c5ff..398b773040 100644 --- a/lib/commands/SETRANGE.spec.ts +++ b/lib/commands/SETRANGE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SETRANGE'; describe('SETRANGE', () => { @@ -10,17 +10,17 @@ describe('SETRANGE', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.setRange', async client => { + testUtils.testWithClient('client.setRange', async client => { assert.equal( await client.setRange('key', 0, 'value'), 5 ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.setRange', async cluster => { + testUtils.testWithCluster('cluster.setRange', async cluster => { assert.equal( await cluster.setRange('key', 0, 'value'), 5 ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/SINTER.spec.ts b/lib/commands/SINTER.spec.ts index 8fee35427c..2324eac3ee 100644 --- a/lib/commands/SINTER.spec.ts +++ b/lib/commands/SINTER.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SINTER'; describe('SINTER', () => { @@ -19,10 +19,10 @@ describe('SINTER', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.sInter', async client => { + testUtils.testWithClient('client.sInter', async client => { assert.deepEqual( await client.sInter('key'), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/SINTERSTORE.spec.ts b/lib/commands/SINTERSTORE.spec.ts index 013931d231..c4a6a095e7 100644 --- a/lib/commands/SINTERSTORE.spec.ts +++ b/lib/commands/SINTERSTORE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SINTERSTORE'; describe('SINTERSTORE', () => { @@ -19,10 +19,10 @@ describe('SINTERSTORE', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.sInterStore', async client => { + testUtils.testWithClient('client.sInterStore', async client => { assert.equal( await client.sInterStore('destination', 'key'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/SISMEMBER.spec.ts b/lib/commands/SISMEMBER.spec.ts index fec4ebfc57..8d18c83697 100644 --- a/lib/commands/SISMEMBER.spec.ts +++ b/lib/commands/SISMEMBER.spec.ts @@ -1,10 +1,8 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SISMEMBER'; describe('SISMEMBER', () => { - describeHandleMinimumRedisVersion([6, 2]); - it('transformArguments', () => { assert.deepEqual( transformArguments('key', 'member'), @@ -12,10 +10,10 @@ describe('SISMEMBER', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.sIsMember', async client => { + testUtils.testWithClient('client.sIsMember', async client => { assert.equal( await client.sIsMember('key', 'member'), false ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/SMEMBERS.spec.ts b/lib/commands/SMEMBERS.spec.ts index 2398dbaa8c..b9c58c9eeb 100644 --- a/lib/commands/SMEMBERS.spec.ts +++ b/lib/commands/SMEMBERS.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SMEMBERS'; describe('SMEMBERS', () => { @@ -10,10 +10,10 @@ describe('SMEMBERS', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.sMembers', async client => { + testUtils.testWithClient('client.sMembers', async client => { assert.deepEqual( await client.sMembers('key'), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/SMISMEMBER.spec.ts b/lib/commands/SMISMEMBER.spec.ts index 320f60d4ba..e372813402 100644 --- a/lib/commands/SMISMEMBER.spec.ts +++ b/lib/commands/SMISMEMBER.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SMISMEMBER'; describe('SMISMEMBER', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); it('transformArguments', () => { assert.deepEqual( @@ -12,10 +12,10 @@ describe('SMISMEMBER', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.smIsMember', async client => { + testUtils.testWithClient('client.smIsMember', async client => { assert.deepEqual( await client.smIsMember('key', ['1', '2']), [false, false] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/SMOVE.spec.ts b/lib/commands/SMOVE.spec.ts index 97e938a46b..e3308ee814 100644 --- a/lib/commands/SMOVE.spec.ts +++ b/lib/commands/SMOVE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SMOVE'; describe('SMOVE', () => { @@ -10,10 +10,10 @@ describe('SMOVE', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.sMove', async client => { + testUtils.testWithClient('client.sMove', async client => { assert.equal( await client.sMove('source', 'destination', 'member'), false ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/SORT.spec.ts b/lib/commands/SORT.spec.ts index c449e0511f..637f48876d 100644 --- a/lib/commands/SORT.spec.ts +++ b/lib/commands/SORT.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SORT'; describe('SORT', () => { @@ -60,7 +60,7 @@ describe('SORT', () => { ['SORT', 'key', 'ASC'] ); }); - + it('with ALPHA', () => { assert.deepEqual( transformArguments('key', { @@ -97,10 +97,10 @@ describe('SORT', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.sort', async client => { + testUtils.testWithClient('client.sort', async client => { assert.deepEqual( await client.sort('key'), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/SPOP.spec.ts b/lib/commands/SPOP.spec.ts index 238c58f479..6a384d181f 100644 --- a/lib/commands/SPOP.spec.ts +++ b/lib/commands/SPOP.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SPOP'; describe('SPOP', () => { @@ -19,10 +19,10 @@ describe('SPOP', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.sPop', async client => { + testUtils.testWithClient('client.sPop', async client => { assert.equal( await client.sPop('key'), null ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/SRANDMEMBER.spec.ts b/lib/commands/SRANDMEMBER.spec.ts index 5c359f73f9..291271540b 100644 --- a/lib/commands/SRANDMEMBER.spec.ts +++ b/lib/commands/SRANDMEMBER.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SRANDMEMBER'; describe('SRANDMEMBER', () => { @@ -10,10 +10,10 @@ describe('SRANDMEMBER', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.sRandMember', async client => { + testUtils.testWithClient('client.sRandMember', async client => { assert.equal( await client.sRandMember('key'), null ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/SRANDMEMBER_COUNT.spec.ts b/lib/commands/SRANDMEMBER_COUNT.spec.ts index 81a4fd45f3..d3d787b3e6 100644 --- a/lib/commands/SRANDMEMBER_COUNT.spec.ts +++ b/lib/commands/SRANDMEMBER_COUNT.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SRANDMEMBER_COUNT'; describe('SRANDMEMBER COUNT', () => { @@ -10,10 +10,10 @@ describe('SRANDMEMBER COUNT', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.sRandMemberCount', async client => { + testUtils.testWithClient('client.sRandMemberCount', async client => { assert.deepEqual( await client.sRandMemberCount('key', 1), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/SREM.spec.ts b/lib/commands/SREM.spec.ts index c9270624ae..d53d7b0334 100644 --- a/lib/commands/SREM.spec.ts +++ b/lib/commands/SREM.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SREM'; describe('SREM', () => { @@ -19,10 +19,10 @@ describe('SREM', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.sRem', async client => { + testUtils.testWithClient('client.sRem', async client => { assert.equal( await client.sRem('key', 'member'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/SSCAN.spec.ts b/lib/commands/SSCAN.spec.ts index 9b203ffb83..71a90bf81d 100644 --- a/lib/commands/SSCAN.spec.ts +++ b/lib/commands/SSCAN.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments, transformReply } from './SSCAN'; describe('SSCAN', () => { @@ -62,7 +62,7 @@ describe('SSCAN', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.sScan', async client => { + testUtils.testWithClient('client.sScan', async client => { assert.deepEqual( await client.sScan('key', 0), { @@ -70,5 +70,5 @@ describe('SSCAN', () => { members: [] } ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/STRLEN.spec.ts b/lib/commands/STRLEN.spec.ts index 3d24e36037..519c68d3e5 100644 --- a/lib/commands/STRLEN.spec.ts +++ b/lib/commands/STRLEN.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './STRLEN'; describe('STRLEN', () => { @@ -10,17 +10,17 @@ describe('STRLEN', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.strLen', async client => { + testUtils.testWithClient('client.strLen', async client => { assert.equal( await client.strLen('key'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.strLen', async cluster => { + testUtils.testWithCluster('cluster.strLen', async cluster => { assert.equal( await cluster.strLen('key'), 0 ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/SUNION.spec.ts b/lib/commands/SUNION.spec.ts index fdf9766897..2918607c1d 100644 --- a/lib/commands/SUNION.spec.ts +++ b/lib/commands/SUNION.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SUNION'; describe('SUNION', () => { @@ -19,10 +19,10 @@ describe('SUNION', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.sUnion', async client => { + testUtils.testWithClient('client.sUnion', async client => { assert.deepEqual( await client.sUnion('key'), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/SUNIONSTORE.spec.ts b/lib/commands/SUNIONSTORE.spec.ts index 82c9a03a0b..142533eea2 100644 --- a/lib/commands/SUNIONSTORE.spec.ts +++ b/lib/commands/SUNIONSTORE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SUNIONSTORE'; describe('SUNIONSTORE', () => { @@ -19,10 +19,10 @@ describe('SUNIONSTORE', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.sUnionStore', async client => { + testUtils.testWithClient('client.sUnionStore', async client => { assert.equal( await client.sUnionStore('destination', 'key'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/SWAPDB.spec.ts b/lib/commands/SWAPDB.spec.ts index 1a5637ae43..add87512a6 100644 --- a/lib/commands/SWAPDB.spec.ts +++ b/lib/commands/SWAPDB.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { itWithClient, TestRedisServers } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './SWAPDB'; describe('SWAPDB', () => { @@ -10,10 +10,10 @@ describe('SWAPDB', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.swapDb', async client => { + testUtils.testWithClient('client.swapDb', async client => { assert.equal( await client.swapDb(0, 1), 'OK' ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/TIME.spec.ts b/lib/commands/TIME.spec.ts index 1a07114af4..bbaa7942db 100644 --- a/lib/commands/TIME.spec.ts +++ b/lib/commands/TIME.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './TIME'; describe('TIME', () => { @@ -10,9 +10,9 @@ describe('TIME', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.time', async client => { + testUtils.testWithClient('client.time', async client => { const reply = await client.time(); assert.ok(reply instanceof Date); assert.ok(typeof reply.microseconds === 'number'); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/TOUCH.spec.ts b/lib/commands/TOUCH.spec.ts index c4cb435629..578c49587d 100644 --- a/lib/commands/TOUCH.spec.ts +++ b/lib/commands/TOUCH.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './TOUCH'; describe('TOUCH', () => { @@ -19,10 +19,10 @@ describe('TOUCH', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.touch', async client => { + testUtils.testWithClient('client.touch', async client => { assert.equal( await client.touch('key'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/TTL.spec.ts b/lib/commands/TTL.spec.ts index bcabe8d39e..e37a6ab714 100644 --- a/lib/commands/TTL.spec.ts +++ b/lib/commands/TTL.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './TTL'; describe('TTL', () => { @@ -10,10 +10,10 @@ describe('TTL', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.ttl', async client => { + testUtils.testWithClient('client.ttl', async client => { assert.equal( await client.ttl('key'), -2 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/TYPE.spec.ts b/lib/commands/TYPE.spec.ts index d40f724242..1040bf979b 100644 --- a/lib/commands/TYPE.spec.ts +++ b/lib/commands/TYPE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './TYPE'; describe('TYPE', () => { @@ -10,10 +10,10 @@ describe('TYPE', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.type', async client => { + testUtils.testWithClient('client.type', async client => { assert.equal( await client.type('key'), 'none' ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/UNLINK.spec.ts b/lib/commands/UNLINK.spec.ts index a0dddf54f2..e8355407d8 100644 --- a/lib/commands/UNLINK.spec.ts +++ b/lib/commands/UNLINK.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './UNLINK'; describe('UNLINK', () => { @@ -19,10 +19,10 @@ describe('UNLINK', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.unlink', async client => { + testUtils.testWithClient('client.unlink', async client => { assert.equal( await client.unlink('key'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/UNWATCH.spec.ts b/lib/commands/UNWATCH.spec.ts index 07059310cb..109ed0fa7c 100644 --- a/lib/commands/UNWATCH.spec.ts +++ b/lib/commands/UNWATCH.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './UNWATCH'; describe('UNWATCH', () => { @@ -10,10 +10,10 @@ describe('UNWATCH', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.unwatch', async client => { + testUtils.testWithClient('client.unwatch', async client => { assert.equal( await client.unwatch(), 'OK' ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/WAIT.spec.ts b/lib/commands/WAIT.spec.ts index c3f53b7db7..c85ef59861 100644 --- a/lib/commands/WAIT.spec.ts +++ b/lib/commands/WAIT.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './WAIT'; describe('WAIT', () => { @@ -10,10 +10,10 @@ describe('WAIT', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.wait', async client => { + testUtils.testWithClient('client.wait', async client => { assert.equal( await client.wait(0, 1), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/XACK.spec.ts b/lib/commands/XACK.spec.ts index fb267c355e..0586a5921f 100644 --- a/lib/commands/XACK.spec.ts +++ b/lib/commands/XACK.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './XACK'; describe('XACK', () => { @@ -19,10 +19,10 @@ describe('XACK', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.xAck', async client => { + testUtils.testWithClient('client.xAck', async client => { assert.equal( await client.xAck('key', 'group', '1-0'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/XADD.spec.ts b/lib/commands/XADD.spec.ts index 02e6888051..4b556ecc27 100644 --- a/lib/commands/XADD.spec.ts +++ b/lib/commands/XADD.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './XADD'; describe('XADD', () => { @@ -60,7 +60,7 @@ describe('XADD', () => { ['XADD', 'key', 'MAXLEN', '1000', '*','field', 'value'] ); }); - + it('with TRIM.strategyModifier', () => { assert.deepEqual( transformArguments('key', '*', { @@ -107,12 +107,12 @@ describe('XADD', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.xAdd', async client => { + testUtils.testWithClient('client.xAdd', async client => { assert.equal( typeof await client.xAdd('key', '*', { field: 'value' }), 'string' ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/XAUTOCLAIM.spec.ts b/lib/commands/XAUTOCLAIM.spec.ts index a0818d5c2c..4447a06d77 100644 --- a/lib/commands/XAUTOCLAIM.spec.ts +++ b/lib/commands/XAUTOCLAIM.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './XAUTOCLAIM'; describe('XAUTOCLAIM', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); describe('transformArguments', () => { it('simple', () => { @@ -23,14 +23,14 @@ describe('XAUTOCLAIM', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.xAutoClaim', async client => { + testUtils.testWithClient('client.xAutoClaim', async client => { await Promise.all([ client.xGroupCreate('key', 'group', '$', { MKSTREAM: true }), client.xGroupCreateConsumer('key', 'group', 'consumer'), ]); - + assert.deepEqual( await client.xAutoClaim('key', 'group', 'consumer', 1, '0-0'), { @@ -38,5 +38,5 @@ describe('XAUTOCLAIM', () => { messages: [] } ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/XAUTOCLAIM_JUSTID.spec.ts b/lib/commands/XAUTOCLAIM_JUSTID.spec.ts index d076f28751..9aa24cd04a 100644 --- a/lib/commands/XAUTOCLAIM_JUSTID.spec.ts +++ b/lib/commands/XAUTOCLAIM_JUSTID.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './XAUTOCLAIM_JUSTID'; describe('XAUTOCLAIM JUSTID', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); it('transformArguments', () => { assert.deepEqual( @@ -12,7 +12,7 @@ describe('XAUTOCLAIM JUSTID', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.xAutoClaimJustId', async client => { + testUtils.testWithClient('client.xAutoClaimJustId', async client => { await Promise.all([ client.xGroupCreate('key', 'group', '$', { MKSTREAM: true @@ -27,5 +27,5 @@ describe('XAUTOCLAIM JUSTID', () => { messages: [] } ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/XCLAIM.spec.ts b/lib/commands/XCLAIM.spec.ts index ff4b445dcf..141a62ab77 100644 --- a/lib/commands/XCLAIM.spec.ts +++ b/lib/commands/XCLAIM.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './XCLAIM'; describe('XCLAIM', () => { @@ -77,14 +77,14 @@ describe('XCLAIM', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.xClaim', async client => { + testUtils.testWithClient('client.xClaim', async client => { await client.xGroupCreate('key', 'group', '$', { MKSTREAM: true }); - + assert.deepEqual( await client.xClaim('key', 'group', 'consumer', 1, '0-0'), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/XCLAIM_JUSTID.spec.ts b/lib/commands/XCLAIM_JUSTID.spec.ts index bb31f2c453..619f876d53 100644 --- a/lib/commands/XCLAIM_JUSTID.spec.ts +++ b/lib/commands/XCLAIM_JUSTID.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './XCLAIM_JUSTID'; describe('XCLAIM JUSTID', () => { @@ -10,14 +10,14 @@ describe('XCLAIM JUSTID', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.xClaimJustId', async client => { + testUtils.testWithClient('client.xClaimJustId', async client => { await client.xGroupCreate('key', 'group', '$', { MKSTREAM: true }); - + assert.deepEqual( await client.xClaimJustId('key', 'group', 'consumer', 1, '0-0'), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/XDEL.spec.ts b/lib/commands/XDEL.spec.ts index 1a3015538f..00f9e2f9c6 100644 --- a/lib/commands/XDEL.spec.ts +++ b/lib/commands/XDEL.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './XDEL'; describe('XDEL', () => { @@ -19,10 +19,10 @@ describe('XDEL', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.xDel', async client => { + testUtils.testWithClient('client.xDel', async client => { assert.equal( await client.xDel('key', '0-0'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/XGROUP_CREATE.spec.ts b/lib/commands/XGROUP_CREATE.spec.ts index fdbb796f10..57516e44cc 100644 --- a/lib/commands/XGROUP_CREATE.spec.ts +++ b/lib/commands/XGROUP_CREATE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './XGROUP_CREATE'; describe('XGROUP CREATE', () => { @@ -21,12 +21,12 @@ describe('XGROUP CREATE', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.xGroupCreate', async client => { + testUtils.testWithClient('client.xGroupCreate', async client => { assert.equal( await client.xGroupCreate('key', 'group', '$', { MKSTREAM: true }), 'OK' ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/XGROUP_CREATECONSUMER.spec.ts b/lib/commands/XGROUP_CREATECONSUMER.spec.ts index 5b06188e30..6244334518 100644 --- a/lib/commands/XGROUP_CREATECONSUMER.spec.ts +++ b/lib/commands/XGROUP_CREATECONSUMER.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './XGROUP_CREATECONSUMER'; describe('XGROUP CREATECONSUMER', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); it('transformArguments', () => { assert.deepEqual( @@ -12,14 +12,14 @@ describe('XGROUP CREATECONSUMER', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.xGroupCreateConsumer', async client => { + testUtils.testWithClient('client.xGroupCreateConsumer', async client => { await client.xGroupCreate('key', 'group', '$', { MKSTREAM: true }); - + assert.equal( await client.xGroupCreateConsumer('key', 'group', 'consumer'), true ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/XGROUP_DELCONSUMER.spec.ts b/lib/commands/XGROUP_DELCONSUMER.spec.ts index c3cf3c2378..d071aedf64 100644 --- a/lib/commands/XGROUP_DELCONSUMER.spec.ts +++ b/lib/commands/XGROUP_DELCONSUMER.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './XGROUP_DELCONSUMER'; describe('XGROUP DELCONSUMER', () => { @@ -10,14 +10,14 @@ describe('XGROUP DELCONSUMER', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.xGroupDelConsumer', async client => { + testUtils.testWithClient('client.xGroupDelConsumer', async client => { await client.xGroupCreate('key', 'group', '$', { MKSTREAM: true }); - + assert.equal( await client.xGroupDelConsumer('key', 'group', 'consumer'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/XGROUP_DESTROY.spec.ts b/lib/commands/XGROUP_DESTROY.spec.ts index e991bc0d66..ea8e7b7be9 100644 --- a/lib/commands/XGROUP_DESTROY.spec.ts +++ b/lib/commands/XGROUP_DESTROY.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './XGROUP_DESTROY'; describe('XGROUP DESTROY', () => { @@ -10,14 +10,14 @@ describe('XGROUP DESTROY', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.xGroupDestroy', async client => { + testUtils.testWithClient('client.xGroupDestroy', async client => { await client.xGroupCreate('key', 'group', '$', { MKSTREAM: true }); - + assert.equal( await client.xGroupDestroy('key', 'group'), true ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/XGROUP_SETID.spec.ts b/lib/commands/XGROUP_SETID.spec.ts index 0fa10cdb0b..8df51f5401 100644 --- a/lib/commands/XGROUP_SETID.spec.ts +++ b/lib/commands/XGROUP_SETID.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './XGROUP_SETID'; describe('XGROUP SETID', () => { @@ -10,7 +10,7 @@ describe('XGROUP SETID', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.xGroupSetId', async client => { + testUtils.testWithClient('client.xGroupSetId', async client => { await client.xGroupCreate('key', 'group', '$', { MKSTREAM: true }); @@ -19,5 +19,5 @@ describe('XGROUP SETID', () => { await client.xGroupSetId('key', 'group', '0'), 'OK' ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/XINFO_CONSUMERS.spec.ts b/lib/commands/XINFO_CONSUMERS.spec.ts index 08ef17e51a..87c82b34f2 100644 --- a/lib/commands/XINFO_CONSUMERS.spec.ts +++ b/lib/commands/XINFO_CONSUMERS.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments, transformReply } from './XINFO_CONSUMERS'; describe('XINFO CONSUMERS', () => { @@ -26,9 +26,9 @@ describe('XINFO CONSUMERS', () => { idle: 83841983 }] ); - }) + }); - itWithClient(TestRedisServers.OPEN, 'client.xInfoConsumers', async client => { + testUtils.testWithClient('client.xInfoConsumers', async client => { await client.xGroupCreate('key', 'group', '$', { MKSTREAM: true }); @@ -37,5 +37,5 @@ describe('XINFO CONSUMERS', () => { await client.xInfoConsumers('key', 'group'), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/XINFO_GROUPS.spec.ts b/lib/commands/XINFO_GROUPS.spec.ts index 8fbd86ee3e..dea8ac58d9 100644 --- a/lib/commands/XINFO_GROUPS.spec.ts +++ b/lib/commands/XINFO_GROUPS.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments, transformReply } from './XINFO_GROUPS'; describe('XINFO GROUPS', () => { @@ -28,9 +28,9 @@ describe('XINFO GROUPS', () => { lastDeliveredId: '1588152498034-0' }] ); - }) + }); - itWithClient(TestRedisServers.OPEN, 'client.xInfoGroups', async client => { + testUtils.testWithClient('client.xInfoGroups', async client => { await client.xGroupCreate('key', 'group', '$', { MKSTREAM: true }); @@ -44,5 +44,5 @@ describe('XINFO GROUPS', () => { lastDeliveredId: '0-0' }] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/XINFO_STREAM.spec.ts b/lib/commands/XINFO_STREAM.spec.ts index ecab605e4e..ca8d44f287 100644 --- a/lib/commands/XINFO_STREAM.spec.ts +++ b/lib/commands/XINFO_STREAM.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments, transformReply } from './XINFO_STREAM'; describe('XINFO STREAM', () => { @@ -51,7 +51,7 @@ describe('XINFO STREAM', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.xInfoStream', async client => { + testUtils.testWithClient('client.xInfoStream', async client => { await client.xGroupCreate('key', 'group', '$', { MKSTREAM: true }); @@ -68,5 +68,5 @@ describe('XINFO STREAM', () => { lastEntry: null } ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/XLEN.spec.ts b/lib/commands/XLEN.spec.ts index c4f62dbc4f..178024ba89 100644 --- a/lib/commands/XLEN.spec.ts +++ b/lib/commands/XLEN.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './XLEN'; describe('XLEN', () => { @@ -10,10 +10,10 @@ describe('XLEN', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.xLen', async client => { + testUtils.testWithClient('client.xLen', async client => { assert.equal( await client.xLen('key'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/XPENDING.spec.ts b/lib/commands/XPENDING.spec.ts index 31ffeeb423..7eb12b40ef 100644 --- a/lib/commands/XPENDING.spec.ts +++ b/lib/commands/XPENDING.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './XPENDING'; describe('XPENDING', () => { @@ -12,7 +12,7 @@ describe('XPENDING', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.xPending', async client => { + testUtils.testWithClient('client.xPending', async client => { await client.xGroupCreate('key', 'group', '$', { MKSTREAM: true }); @@ -26,5 +26,5 @@ describe('XPENDING', () => { consumers: null } ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/XPENDING_RANGE.spec.ts b/lib/commands/XPENDING_RANGE.spec.ts index 76a582d3db..0b57c704bb 100644 --- a/lib/commands/XPENDING_RANGE.spec.ts +++ b/lib/commands/XPENDING_RANGE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './XPENDING_RANGE'; describe('XPENDING RANGE', () => { @@ -10,7 +10,7 @@ describe('XPENDING RANGE', () => { ['XPENDING', 'key', 'group', '-', '+', '1'] ); }); - + it('with IDLE', () => { assert.deepEqual( transformArguments('key', 'group', '-', '+', 1, { @@ -40,14 +40,14 @@ describe('XPENDING RANGE', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.xPendingRange', async client => { + testUtils.testWithClient('client.xPendingRange', async client => { await client.xGroupCreate('key', 'group', '$', { MKSTREAM: true }); - + assert.deepEqual( await client.xPendingRange('key', 'group', '-', '+', 1), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/XRANGE.spec.ts b/lib/commands/XRANGE.spec.ts index 55efa9d772..01c713e959 100644 --- a/lib/commands/XRANGE.spec.ts +++ b/lib/commands/XRANGE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './XRANGE'; describe('XRANGE', () => { @@ -10,7 +10,7 @@ describe('XRANGE', () => { ['XRANGE', 'key', '-', '+'] ); }); - + it('with COUNT', () => { assert.deepEqual( transformArguments('key', '-', '+', { @@ -21,10 +21,10 @@ describe('XRANGE', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.xRange', async client => { + testUtils.testWithClient('client.xRange', async client => { assert.deepEqual( await client.xRange('key', '+', '-'), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/XREAD.spec.ts b/lib/commands/XREAD.spec.ts index 501571bfbe..b607f53532 100644 --- a/lib/commands/XREAD.spec.ts +++ b/lib/commands/XREAD.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { FIRST_KEY_INDEX, transformArguments } from './XREAD'; describe('XREAD', () => { @@ -81,7 +81,7 @@ describe('XREAD', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.xRead', async client => { + testUtils.testWithClient('client.xRead', async client => { assert.equal( await client.xRead({ key: 'key', @@ -89,9 +89,9 @@ describe('XREAD', () => { }), null ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'cluster.xRead', async cluster => { + testUtils.testWithCluster('cluster.xRead', async cluster => { assert.equal( await cluster.xRead({ key: 'key', @@ -99,5 +99,5 @@ describe('XREAD', () => { }), null ); - }); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/XREADGROUP.spec.ts b/lib/commands/XREADGROUP.spec.ts index 8cb3147bfe..fa196d504a 100644 --- a/lib/commands/XREADGROUP.spec.ts +++ b/lib/commands/XREADGROUP.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { FIRST_KEY_INDEX, transformArguments } from './XREADGROUP'; describe('XREADGROUP', () => { @@ -94,36 +94,22 @@ describe('XREADGROUP', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'null', async client => { - const [, readGroupReply] = await Promise.all([ - client.xGroupCreate('key', 'group', '$', { - MKSTREAM: true - }), - client.xReadGroup('group', 'consumer', { - key: 'key', - id: '>' - }) - ]); - - assert.equal(readGroupReply, null); - }); - - describe('cluster.xReadGroup', () => { - itWithCluster(TestRedisClusters.OPEN, 'null', async cluster => { + describe('client.xReadGroup', () => { + testUtils.testWithClient('null', async client => { const [, readGroupReply] = await Promise.all([ - cluster.xGroupCreate('key', 'group', '$', { + client.xGroupCreate('key', 'group', '$', { MKSTREAM: true }), - cluster.xReadGroup('group', 'consumer', { + client.xReadGroup('group', 'consumer', { key: 'key', id: '>' }) ]); assert.equal(readGroupReply, null); - }); + }, GLOBAL.SERVERS.OPEN); - itWithCluster(TestRedisClusters.OPEN, 'with a message', async client => { + testUtils.testWithClient('with a message', async client => { const [, id, readGroupReply] = await Promise.all([ client.xGroupCreate('key', 'group', '$', { MKSTREAM: true @@ -148,6 +134,20 @@ describe('XREADGROUP', () => { }) }] }]); - }); + }, GLOBAL.SERVERS.OPEN); }); + + testUtils.testWithCluster('cluster.xReadGroup', async cluster => { + const [, readGroupReply] = await Promise.all([ + cluster.xGroupCreate('key', 'group', '$', { + MKSTREAM: true + }), + cluster.xReadGroup('group', 'consumer', { + key: 'key', + id: '>' + }) + ]); + + assert.equal(readGroupReply, null); + }, GLOBAL.CLUSTERS.OPEN); }); diff --git a/lib/commands/XREVRANGE.spec.ts b/lib/commands/XREVRANGE.spec.ts index ba009cc2bb..fd6e1a3adf 100644 --- a/lib/commands/XREVRANGE.spec.ts +++ b/lib/commands/XREVRANGE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './XREVRANGE'; describe('XREVRANGE', () => { @@ -10,7 +10,7 @@ describe('XREVRANGE', () => { ['XREVRANGE', 'key', '-', '+'] ); }); - + it('with COUNT', () => { assert.deepEqual( transformArguments('key', '-', '+', { @@ -21,10 +21,10 @@ describe('XREVRANGE', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.xRevRange', async client => { + testUtils.testWithClient('client.xRevRange', async client => { assert.deepEqual( await client.xRevRange('key', '+', '-'), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/XTRIM.spec.ts b/lib/commands/XTRIM.spec.ts index 0b48fd6a2d..a8f8078eb2 100644 --- a/lib/commands/XTRIM.spec.ts +++ b/lib/commands/XTRIM.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './XTRIM'; describe('XTRIM', () => { @@ -40,10 +40,10 @@ describe('XTRIM', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.xTrim', async client => { + testUtils.testWithClient('client.xTrim', async client => { assert.equal( await client.xTrim('key', 'MAXLEN', 1), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZADD.spec.ts b/lib/commands/ZADD.spec.ts index 7c017e4541..4f497bdca9 100644 --- a/lib/commands/ZADD.spec.ts +++ b/lib/commands/ZADD.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZADD'; describe('ZADD', () => { @@ -115,7 +115,7 @@ describe('ZADD', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.zAdd', async client => { + testUtils.testWithClient('client.zAdd', async client => { assert.equal( await client.zAdd('key', { value: '1', @@ -123,5 +123,5 @@ describe('ZADD', () => { }), 1 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZCARD.spec.ts b/lib/commands/ZCARD.spec.ts index 03bfe59cfc..2e90da772b 100644 --- a/lib/commands/ZCARD.spec.ts +++ b/lib/commands/ZCARD.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZCARD'; describe('ZCARD', () => { @@ -10,10 +10,10 @@ describe('ZCARD', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.zCard', async client => { + testUtils.testWithClient('client.zCard', async client => { assert.equal( await client.zCard('key'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZCOUNT.spec.ts b/lib/commands/ZCOUNT.spec.ts index e461241ce1..e185ed3cd4 100644 --- a/lib/commands/ZCOUNT.spec.ts +++ b/lib/commands/ZCOUNT.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZCOUNT'; describe('ZCOUNT', () => { @@ -10,10 +10,10 @@ describe('ZCOUNT', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.zCount', async client => { + testUtils.testWithClient('client.zCount', async client => { assert.equal( await client.zCount('key', 0, 1), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZDIFF.spec.ts b/lib/commands/ZDIFF.spec.ts index f45b2af7ed..8bb1a101f5 100644 --- a/lib/commands/ZDIFF.spec.ts +++ b/lib/commands/ZDIFF.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZDIFF'; describe('ZDIFF', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); describe('transformArguments', () => { it('string', () => { @@ -21,10 +21,10 @@ describe('ZDIFF', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.zDiff', async client => { + testUtils.testWithClient('client.zDiff', async client => { assert.deepEqual( await client.zDiff('key'), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZDIFFSTORE.spec.ts b/lib/commands/ZDIFFSTORE.spec.ts index 5fbeebaf50..c63902b266 100644 --- a/lib/commands/ZDIFFSTORE.spec.ts +++ b/lib/commands/ZDIFFSTORE.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZDIFFSTORE'; describe('ZDIFFSTORE', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); describe('transformArguments', () => { it('string', () => { @@ -21,10 +21,10 @@ describe('ZDIFFSTORE', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.zDiffStore', async client => { + testUtils.testWithClient('client.zDiffStore', async client => { assert.equal( await client.zDiffStore('destination', 'key'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZDIFF_WITHSCORES.spec.ts b/lib/commands/ZDIFF_WITHSCORES.spec.ts index 99c2310829..3b9cb725aa 100644 --- a/lib/commands/ZDIFF_WITHSCORES.spec.ts +++ b/lib/commands/ZDIFF_WITHSCORES.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZDIFF_WITHSCORES'; describe('ZDIFF WITHSCORES', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); describe('transformArguments', () => { it('string', () => { @@ -21,10 +21,10 @@ describe('ZDIFF WITHSCORES', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.zDiffWithScores', async client => { + testUtils.testWithClient('client.zDiffWithScores', async client => { assert.deepEqual( await client.zDiffWithScores('key'), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZINCRBY.spec.ts b/lib/commands/ZINCRBY.spec.ts index 2196c63ec0..bf2a34b096 100644 --- a/lib/commands/ZINCRBY.spec.ts +++ b/lib/commands/ZINCRBY.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZINCRBY'; describe('ZINCRBY', () => { @@ -10,10 +10,10 @@ describe('ZINCRBY', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.zIncrBy', async client => { + testUtils.testWithClient('client.zIncrBy', async client => { assert.equal( await client.zIncrBy('destination', 1, 'member'), 1 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZINTER.spec.ts b/lib/commands/ZINTER.spec.ts index 998c46fd3e..4d2d86c886 100644 --- a/lib/commands/ZINTER.spec.ts +++ b/lib/commands/ZINTER.spec.ts @@ -1,10 +1,10 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZINTER'; describe('ZINTER', () => { - describeHandleMinimumRedisVersion([6, 2]); - + testUtils.isVersionGreaterThanHook([6, 2]); + describe('transformArguments', () => { it('key (string)', () => { assert.deepEqual( @@ -49,10 +49,10 @@ describe('ZINTER', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.zInter', async client => { + testUtils.testWithClient('client.zInter', async client => { assert.deepEqual( await client.zInter('key'), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZINTERSTORE.spec.ts b/lib/commands/ZINTERSTORE.spec.ts index fca03157cb..224961f078 100644 --- a/lib/commands/ZINTERSTORE.spec.ts +++ b/lib/commands/ZINTERSTORE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZINTERSTORE'; describe('ZINTERSTORE', () => { @@ -47,10 +47,10 @@ describe('ZINTERSTORE', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.zInterStore', async client => { + testUtils.testWithClient('client.zInterStore', async client => { assert.equal( await client.zInterStore('destination', 'key'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZINTER_WITHSCORES.spec.ts b/lib/commands/ZINTER_WITHSCORES.spec.ts index f66787e3de..0eaeb26a24 100644 --- a/lib/commands/ZINTER_WITHSCORES.spec.ts +++ b/lib/commands/ZINTER_WITHSCORES.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZINTER_WITHSCORES'; describe('ZINTER WITHSCORES', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); describe('transformArguments', () => { it('key (string)', () => { @@ -49,10 +49,10 @@ describe('ZINTER WITHSCORES', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.zInterWithScores', async client => { + testUtils.testWithClient('client.zInterWithScores', async client => { assert.deepEqual( await client.zInterWithScores('key'), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZLEXCOUNT.spec.ts b/lib/commands/ZLEXCOUNT.spec.ts index b106ba0cdc..85809f1a9a 100644 --- a/lib/commands/ZLEXCOUNT.spec.ts +++ b/lib/commands/ZLEXCOUNT.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZLEXCOUNT'; describe('ZLEXCOUNT', () => { @@ -10,10 +10,10 @@ describe('ZLEXCOUNT', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.zLexCount', async client => { + testUtils.testWithClient('client.zLexCount', async client => { assert.equal( await client.zLexCount('key', '[a', '[b'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZMSCORE.spec.ts b/lib/commands/ZMSCORE.spec.ts index 3cf3845392..228c8e9d6f 100644 --- a/lib/commands/ZMSCORE.spec.ts +++ b/lib/commands/ZMSCORE.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZMSCORE'; describe('ZMSCORE', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); describe('transformArguments', () => { it('string', () => { @@ -21,10 +21,10 @@ describe('ZMSCORE', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.zmScore', async client => { + testUtils.testWithClient('client.zmScore', async client => { assert.deepEqual( await client.zmScore('key', 'member'), [null] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZPOPMAX.spec.ts b/lib/commands/ZPOPMAX.spec.ts index ceab3cad1d..18fba23a3e 100644 --- a/lib/commands/ZPOPMAX.spec.ts +++ b/lib/commands/ZPOPMAX.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments, transformReply } from './ZPOPMAX'; describe('ZPOPMAX', () => { @@ -21,14 +21,14 @@ describe('ZPOPMAX', () => { }); describe('client.zPopMax', () => { - itWithClient(TestRedisServers.OPEN, 'null', async client => { + testUtils.testWithClient('null', async client => { assert.equal( await client.zPopMax('key'), null ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithClient(TestRedisServers.OPEN, 'member', async client => { + testUtils.testWithClient('member', async client => { const member = { score: 1, value: 'value' }, [, zPopMaxReply] = await Promise.all([ client.zAdd('key', member), @@ -36,6 +36,6 @@ describe('ZPOPMAX', () => { ]); assert.deepEqual(zPopMaxReply, member); - }); + }, GLOBAL.SERVERS.OPEN); }); }); diff --git a/lib/commands/ZPOPMAX_COUNT.spec.ts b/lib/commands/ZPOPMAX_COUNT.spec.ts index c0e71977ee..b282d0d319 100644 --- a/lib/commands/ZPOPMAX_COUNT.spec.ts +++ b/lib/commands/ZPOPMAX_COUNT.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZPOPMAX_COUNT'; describe('ZPOPMAX COUNT', () => { @@ -10,10 +10,10 @@ describe('ZPOPMAX COUNT', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.zPopMaxCount', async client => { + testUtils.testWithClient('client.zPopMaxCount', async client => { assert.deepEqual( await client.zPopMaxCount('key', 1), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZPOPMIN.spec.ts b/lib/commands/ZPOPMIN.spec.ts index c69ca7c27f..624b705440 100644 --- a/lib/commands/ZPOPMIN.spec.ts +++ b/lib/commands/ZPOPMIN.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments, transformReply } from './ZPOPMIN'; describe('ZPOPMIN', () => { @@ -21,14 +21,14 @@ describe('ZPOPMIN', () => { }); describe('client.zPopMin', () => { - itWithClient(TestRedisServers.OPEN, 'null', async client => { + testUtils.testWithClient('null', async client => { assert.equal( await client.zPopMin('key'), null ); - }); + }, GLOBAL.SERVERS.OPEN); - itWithClient(TestRedisServers.OPEN, 'member', async client => { + testUtils.testWithClient('member', async client => { const member = { score: 1, value: 'value' }, [, zPopMinReply] = await Promise.all([ client.zAdd('key', member), @@ -36,6 +36,6 @@ describe('ZPOPMIN', () => { ]); assert.deepEqual(zPopMinReply, member); - }); + }, GLOBAL.SERVERS.OPEN); }); }); diff --git a/lib/commands/ZPOPMIN_COUNT.spec.ts b/lib/commands/ZPOPMIN_COUNT.spec.ts index 1c2745a0fd..6d40002ab7 100644 --- a/lib/commands/ZPOPMIN_COUNT.spec.ts +++ b/lib/commands/ZPOPMIN_COUNT.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZPOPMIN_COUNT'; describe('ZPOPMIN COUNT', () => { @@ -10,10 +10,10 @@ describe('ZPOPMIN COUNT', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.zPopMinCount', async client => { + testUtils.testWithClient('client.zPopMinCount', async client => { assert.deepEqual( await client.zPopMinCount('key', 1), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZRANDMEMBER.spec.ts b/lib/commands/ZRANDMEMBER.spec.ts index da31641a18..c57d26f830 100644 --- a/lib/commands/ZRANDMEMBER.spec.ts +++ b/lib/commands/ZRANDMEMBER.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZRANDMEMBER'; describe('ZRANDMEMBER', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); it('transformArguments', () => { assert.deepEqual( @@ -12,10 +12,10 @@ describe('ZRANDMEMBER', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.zRandMember', async client => { + testUtils.testWithClient('client.zRandMember', async client => { assert.equal( await client.zRandMember('key'), null ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZRANDMEMBER_COUNT.spec.ts b/lib/commands/ZRANDMEMBER_COUNT.spec.ts index 4c873c82d9..10db0727b2 100644 --- a/lib/commands/ZRANDMEMBER_COUNT.spec.ts +++ b/lib/commands/ZRANDMEMBER_COUNT.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZRANDMEMBER_COUNT'; describe('ZRANDMEMBER COUNT', () => { - describeHandleMinimumRedisVersion([6, 2, 5]); + testUtils.isVersionGreaterThanHook([6, 2, 5]); it('transformArguments', () => { assert.deepEqual( @@ -12,10 +12,10 @@ describe('ZRANDMEMBER COUNT', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.zRandMemberCount', async client => { + testUtils.testWithClient('client.zRandMemberCount', async client => { assert.deepEqual( await client.zRandMemberCount('key', 1), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZRANDMEMBER_COUNT_WITHSCORES.spec.ts b/lib/commands/ZRANDMEMBER_COUNT_WITHSCORES.spec.ts index 55624361fb..5b5ec1f500 100644 --- a/lib/commands/ZRANDMEMBER_COUNT_WITHSCORES.spec.ts +++ b/lib/commands/ZRANDMEMBER_COUNT_WITHSCORES.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZRANDMEMBER_COUNT_WITHSCORES'; describe('ZRANDMEMBER COUNT WITHSCORES', () => { - describeHandleMinimumRedisVersion([6, 2, 5]); + testUtils.isVersionGreaterThanHook([6, 2, 5]); it('transformArguments', () => { assert.deepEqual( @@ -12,10 +12,10 @@ describe('ZRANDMEMBER COUNT WITHSCORES', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.zRandMemberCountWithScores', async client => { + testUtils.testWithClient('client.zRandMemberCountWithScores', async client => { assert.deepEqual( await client.zRandMemberCountWithScores('key', 1), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZRANGE.spec.ts b/lib/commands/ZRANGE.spec.ts index 7347ed0ad0..03687c2ba9 100644 --- a/lib/commands/ZRANGE.spec.ts +++ b/lib/commands/ZRANGE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZRANGE'; describe('ZRANGE', () => { @@ -72,10 +72,10 @@ describe('ZRANGE', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.zRange', async client => { + testUtils.testWithClient('client.zRange', async client => { assert.deepEqual( await client.zRange('src', 0, 1), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZRANGEBYLEX.spec.ts b/lib/commands/ZRANGEBYLEX.spec.ts index 7f68750954..fe7b7d5a16 100644 --- a/lib/commands/ZRANGEBYLEX.spec.ts +++ b/lib/commands/ZRANGEBYLEX.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZRANGEBYLEX'; describe('ZRANGEBYLEX', () => { @@ -24,10 +24,10 @@ describe('ZRANGEBYLEX', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.zRangeByLex', async client => { + testUtils.testWithClient('client.zRangeByLex', async client => { assert.deepEqual( await client.zRangeByLex('src', '-', '+'), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZRANGEBYSCORE.spec.ts b/lib/commands/ZRANGEBYSCORE.spec.ts index 0419b23256..a348432630 100644 --- a/lib/commands/ZRANGEBYSCORE.spec.ts +++ b/lib/commands/ZRANGEBYSCORE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZRANGEBYSCORE'; describe('ZRANGEBYSCORE', () => { @@ -24,10 +24,10 @@ describe('ZRANGEBYSCORE', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.zRangeByScore', async client => { + testUtils.testWithClient('client.zRangeByScore', async client => { assert.deepEqual( await client.zRangeByScore('src', 0, 1), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZRANGEBYSCORE_WITHSCORES.spec.ts b/lib/commands/ZRANGEBYSCORE_WITHSCORES.spec.ts index 84d1aeb0aa..3552d3e253 100644 --- a/lib/commands/ZRANGEBYSCORE_WITHSCORES.spec.ts +++ b/lib/commands/ZRANGEBYSCORE_WITHSCORES.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZRANGEBYSCORE_WITHSCORES'; describe('ZRANGEBYSCORE WITHSCORES', () => { @@ -24,10 +24,10 @@ describe('ZRANGEBYSCORE WITHSCORES', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.zRangeByScoreWithScores', async client => { + testUtils.testWithClient('client.zRangeByScoreWithScores', async client => { assert.deepEqual( await client.zRangeByScoreWithScores('src', 0, 1), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZRANGESTORE.spec.ts b/lib/commands/ZRANGESTORE.spec.ts index 5405565640..7af253e539 100644 --- a/lib/commands/ZRANGESTORE.spec.ts +++ b/lib/commands/ZRANGESTORE.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments, transformReply } from './ZRANGESTORE'; describe('ZRANGESTORE', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); describe('transformArguments', () => { it('simple', () => { @@ -71,13 +71,14 @@ describe('ZRANGESTORE', () => { describe('transformReply', () => { it('should throw TypeError when reply is not a number', () => { assert.throws( + // eslint-disable-next-line @typescript-eslint/no-explicit-any () => (transformReply as any)([]), TypeError ); }); }); - itWithClient(TestRedisServers.OPEN, 'client.zRangeStore', async client => { + testUtils.testWithClient('client.zRangeStore', async client => { await client.zAdd('src', { score: 0.5, value: 'value' @@ -87,5 +88,5 @@ describe('ZRANGESTORE', () => { await client.zRangeStore('dst', 'src', 0, 1), 1 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZRANGE_WITHSCORES.spec.ts b/lib/commands/ZRANGE_WITHSCORES.spec.ts index 4c739b3d3b..d9b07e19dd 100644 --- a/lib/commands/ZRANGE_WITHSCORES.spec.ts +++ b/lib/commands/ZRANGE_WITHSCORES.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZRANGE_WITHSCORES'; describe('ZRANGE WITHSCORES', () => { @@ -56,10 +56,10 @@ describe('ZRANGE WITHSCORES', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.zRangeWithScores', async client => { + testUtils.testWithClient('client.zRangeWithScores', async client => { assert.deepEqual( await client.zRangeWithScores('src', 0, 1), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZRANK.spec.ts b/lib/commands/ZRANK.spec.ts index 8dd9c924cc..0c81517a7d 100644 --- a/lib/commands/ZRANK.spec.ts +++ b/lib/commands/ZRANK.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZRANK'; describe('ZRANK', () => { @@ -10,10 +10,10 @@ describe('ZRANK', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.zRank', async client => { + testUtils.testWithClient('client.zRank', async client => { assert.equal( await client.zRank('key', 'member'), null ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZREM.spec.ts b/lib/commands/ZREM.spec.ts index d613832035..3ac001708a 100644 --- a/lib/commands/ZREM.spec.ts +++ b/lib/commands/ZREM.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZREM'; describe('ZREM', () => { @@ -19,10 +19,10 @@ describe('ZREM', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.zRem', async client => { + testUtils.testWithClient('client.zRem', async client => { assert.equal( await client.zRem('key', 'member'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZREMRANGEBYLEX.spec.ts b/lib/commands/ZREMRANGEBYLEX.spec.ts index 7aae059480..b59c9e9f3b 100644 --- a/lib/commands/ZREMRANGEBYLEX.spec.ts +++ b/lib/commands/ZREMRANGEBYLEX.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZREMRANGEBYLEX'; describe('ZREMRANGEBYLEX', () => { @@ -10,10 +10,10 @@ describe('ZREMRANGEBYLEX', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.zRemRangeByLex', async client => { + testUtils.testWithClient('client.zRemRangeByLex', async client => { assert.equal( await client.zRemRangeByLex('key', '[a', '[b'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZREMRANGEBYRANK.spec.ts b/lib/commands/ZREMRANGEBYRANK.spec.ts index 401b57c8e2..c659dadb79 100644 --- a/lib/commands/ZREMRANGEBYRANK.spec.ts +++ b/lib/commands/ZREMRANGEBYRANK.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZREMRANGEBYRANK'; describe('ZREMRANGEBYRANK', () => { @@ -10,10 +10,10 @@ describe('ZREMRANGEBYRANK', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.zRemRangeByRank', async client => { + testUtils.testWithClient('client.zRemRangeByRank', async client => { assert.equal( await client.zRemRangeByRank('key', 0, 1), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZREMRANGEBYSCORE.spec.ts b/lib/commands/ZREMRANGEBYSCORE.spec.ts index 141392e772..988fd7690c 100644 --- a/lib/commands/ZREMRANGEBYSCORE.spec.ts +++ b/lib/commands/ZREMRANGEBYSCORE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZREMRANGEBYSCORE'; describe('ZREMRANGEBYSCORE', () => { @@ -10,10 +10,10 @@ describe('ZREMRANGEBYSCORE', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.zRemRangeByScore', async client => { + testUtils.testWithClient('client.zRemRangeByScore', async client => { assert.equal( await client.zRemRangeByScore('key', 0, 1), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZREVRANK.spec.ts b/lib/commands/ZREVRANK.spec.ts index 727a61a35a..d9fef0d70a 100644 --- a/lib/commands/ZREVRANK.spec.ts +++ b/lib/commands/ZREVRANK.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZREVRANK'; describe('ZREVRANK', () => { @@ -10,10 +10,10 @@ describe('ZREVRANK', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.zRevRank', async client => { + testUtils.testWithClient('client.zRevRank', async client => { assert.equal( await client.zRevRank('key', 'member'), null ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZSCAN.spec.ts b/lib/commands/ZSCAN.spec.ts index 3ff0c0a52b..afa221a1ef 100644 --- a/lib/commands/ZSCAN.spec.ts +++ b/lib/commands/ZSCAN.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments, transformReply } from './ZSCAN'; describe('ZSCAN', () => { @@ -65,7 +65,7 @@ describe('ZSCAN', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.zScan', async client => { + testUtils.testWithClient('client.zScan', async client => { assert.deepEqual( await client.zScan('key', 0), { @@ -73,5 +73,5 @@ describe('ZSCAN', () => { members: [] } ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZSCORE.spec.ts b/lib/commands/ZSCORE.spec.ts index d346a2e2c8..fe2a1c6a7c 100644 --- a/lib/commands/ZSCORE.spec.ts +++ b/lib/commands/ZSCORE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZSCORE'; describe('ZSCORE', () => { @@ -10,10 +10,10 @@ describe('ZSCORE', () => { ); }); - itWithClient(TestRedisServers.OPEN, 'client.zScore', async client => { + testUtils.testWithClient('client.zScore', async client => { assert.equal( await client.zScore('key', 'member'), null ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZUNION.spec.ts b/lib/commands/ZUNION.spec.ts index 12e9283393..c53498cbf6 100644 --- a/lib/commands/ZUNION.spec.ts +++ b/lib/commands/ZUNION.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZUNION'; describe('ZUNION', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); describe('transformArguments', () => { it('key (string)', () => { @@ -39,10 +39,10 @@ describe('ZUNION', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.zUnion', async client => { + testUtils.testWithClient('client.zUnion', async client => { assert.deepEqual( await client.zUnion('key'), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZUNIONSTORE.spec.ts b/lib/commands/ZUNIONSTORE.spec.ts index 0c4d7a3006..8f11828b22 100644 --- a/lib/commands/ZUNIONSTORE.spec.ts +++ b/lib/commands/ZUNIONSTORE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZUNIONSTORE'; describe('ZUNIONSTORE', () => { @@ -47,10 +47,10 @@ describe('ZUNIONSTORE', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.zUnionStore', async client => { + testUtils.testWithClient('client.zUnionStore', async client => { assert.equal( await client.zUnionStore('destination', 'key'), 0 ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/ZUNION_WITHSCORES.spec.ts b/lib/commands/ZUNION_WITHSCORES.spec.ts index d9c65ba5e4..3786a97963 100644 --- a/lib/commands/ZUNION_WITHSCORES.spec.ts +++ b/lib/commands/ZUNION_WITHSCORES.spec.ts @@ -1,9 +1,9 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; +import testUtils, { GLOBAL } from '../test-utils'; import { transformArguments } from './ZUNION_WITHSCORES'; describe('ZUNION WITHSCORES', () => { - describeHandleMinimumRedisVersion([6, 2]); + testUtils.isVersionGreaterThanHook([6, 2]); describe('transformArguments', () => { it('key (string)', () => { @@ -39,10 +39,10 @@ describe('ZUNION WITHSCORES', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.zUnionWithScores', async client => { + testUtils.testWithClient('client.zUnionWithScores', async client => { assert.deepEqual( await client.zUnionWithScores('key'), [] ); - }); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/lib/commands/generic-transformers.spec.ts b/lib/commands/generic-transformers.spec.ts index bdc3ee938c..887d8720de 100644 --- a/lib/commands/generic-transformers.spec.ts +++ b/lib/commands/generic-transformers.spec.ts @@ -268,7 +268,7 @@ describe('Generic Transformers', () => { }) }] }] - ) + ); }); }); diff --git a/lib/errors.ts b/lib/errors.ts index 3f5fe40c20..79a438aa1d 100644 --- a/lib/errors.ts +++ b/lib/errors.ts @@ -27,3 +27,9 @@ export class DisconnectsClientError extends Error { super('Disconnects client'); } } + +export class SocketClosedUnexpectedlyError extends Error { + constructor() { + super('Socket closed unexpectedly'); + } +} diff --git a/lib/test-utils.ts b/lib/test-utils.ts deleted file mode 100644 index 42eb9df500..0000000000 --- a/lib/test-utils.ts +++ /dev/null @@ -1,384 +0,0 @@ -import { strict as assert } from 'assert'; -import RedisClient, { RedisClientOptions, RedisClientType } from './client'; -import { execSync, spawn } from 'child_process'; -import { once } from 'events'; -import which from 'which'; -import { SinonSpy } from 'sinon'; -import RedisCluster, { RedisClusterOptions, RedisClusterType } from './cluster'; -import { promises as fs } from 'fs'; -import { Context as MochaContext } from 'mocha'; -import { promiseTimeout } from './utils'; -import { RedisModules, RedisScripts } from './commands'; - -type RedisVersion = [major: number, minor: number, patch: number]; - -type PartialRedisVersion = RedisVersion | [major: number, minor: number] | [major: number]; - -const REDIS_PATH = which.sync('redis-server'); -export const REDIS_VERSION = getRedisVersion(); - -function getRedisVersion(): RedisVersion { - const raw = execSync(`${REDIS_PATH} -v`).toString(), - indexOfVersion = raw.indexOf('v='); - - if (indexOfVersion === -1) { - throw new Error('Unknown redis version'); - } - - const start = indexOfVersion + 2; - return raw.substring( - start, - raw.indexOf(' ', start) - ).split('.', 3).map(Number) as RedisVersion; -} - -export function isRedisVersionGreaterThan(minimumVersion: PartialRedisVersion | undefined): boolean { - if (minimumVersion === undefined) return true; - - const lastIndex = minimumVersion.length - 1; - for (let i = 0; i < lastIndex; i++) { - if (REDIS_VERSION[i] > minimumVersion[i]) { - return true; - } else if (minimumVersion[i] > REDIS_VERSION[i]) { - return false; - } - } - - return REDIS_VERSION[lastIndex] >= minimumVersion[lastIndex]; -} - -export enum TestRedisServers { - OPEN, - PASSWORD -} - -export const TEST_REDIS_SERVERS: Record, 'modules' | 'scripts'>> = {}; - -export enum TestRedisClusters { - OPEN -} - -export const TEST_REDIS_CLUSTERES: Record, 'modules' | 'scripts'>> = {}; - -let port = 6379; - -interface SpawnRedisServerResult { - port: number; - cleanup: () => Promise; -} - -async function spawnRedisServer(args?: Array): Promise { - const currentPort = port++, - process = spawn(REDIS_PATH, [ - '--save', - '', - '--port', - currentPort.toString(), - ...(args ?? []) - ]); - - process - .once('error', err => console.error('Redis process error', err)) - .once('close', code => console.error(`Redis process closed unexpectedly with code ${code}`)); - - for await (const chunk of process.stdout) { - if (chunk.toString().includes('Ready to accept connections')) { - break; - } - } - - if (process.exitCode !== null) { - throw new Error('Error while spawning redis server'); - } - - return { - port: currentPort, - async cleanup(): Promise { - process.removeAllListeners('close'); - assert.ok(process.kill()); - await once(process, 'close'); - } - }; -} - -async function spawnGlobalRedisServer(args?: Array): Promise { - const { port, cleanup } = await spawnRedisServer(args); - after(cleanup); - return port; -} - -const SLOTS = 16384; - -interface SpawnRedisClusterNodeResult extends SpawnRedisServerResult { - client: RedisClientType -} - -async function spawnRedisClusterNode( - type: TestRedisClusters | null, - nodeIndex: number, - fromSlot: number, - toSlot: number, - args?: Array -): Promise { - const clusterConfigFile = `/tmp/${type}-${nodeIndex}.conf`, - { port, cleanup: originalCleanup } = await spawnRedisServer([ - '--cluster-enabled', - 'yes', - '--cluster-node-timeout', - '5000', - '--cluster-config-file', - clusterConfigFile, - ...(args ?? []) - ]); - - const client = RedisClient.create({ - socket: { - port - } - }); - - await client.connect(); - - const range = []; - for (let i = fromSlot; i < toSlot; i++) { - range.push(i); - } - - await Promise.all([ - client.clusterFlushSlots(), - client.clusterAddSlots(range) - ]); - - return { - port, - async cleanup(): Promise { - await originalCleanup(); - - try { - await fs.unlink(clusterConfigFile); - } catch (err: any) { - if (err.code === 'ENOENT') return; - - throw err; - } - }, - client - }; -} - -export async function spawnRedisCluster(type: TestRedisClusters | null, numberOfNodes: number, args?: Array): Promise> { - const spawnPromises = [], - slotsPerNode = Math.floor(SLOTS / numberOfNodes); - for (let i = 0; i < numberOfNodes; i++) { - const fromSlot = i * slotsPerNode; - spawnPromises.push( - spawnRedisClusterNode( - type, - i, - fromSlot, - i === numberOfNodes - 1 ? SLOTS : fromSlot + slotsPerNode, - args - ) - ); - } - - const spawnResults = await Promise.all(spawnPromises), - meetPromises = []; - for (let i = 1; i < spawnResults.length; i++) { - meetPromises.push( - spawnResults[i].client.clusterMeet( - '127.0.0.1', - spawnResults[i - 1].port - ) - ); - } - - await Promise.all(meetPromises); - - while (!(await clusterIsReady(spawnResults))) { - await promiseTimeout(100); - } - - await Promise.all( - spawnResults.map(result => result.client.disconnect()) - ); - - return spawnResults; -} - -async function clusterIsReady(spawnResults: Array): Promise { - const nodesClusetrInfo = await Promise.all( - spawnResults.map(result => result.client.clusterInfo()) - ); - - return nodesClusetrInfo.every(({ state }) => state === 'ok'); -} - -export async function spawnGlobalRedisCluster(type: TestRedisClusters | null, numberOfNodes: number, args?: Array): Promise> { - const results = await spawnRedisCluster(type, numberOfNodes, args); - - after(() => Promise.all( - results.map(({ cleanup }) => cleanup()) - )); - - return results.map(({ port }) => port); -} - -async function spawnOpenServer(): Promise { - TEST_REDIS_SERVERS[TestRedisServers.OPEN] = { - socket: { - port: await spawnGlobalRedisServer() - } - }; -} - -async function spawnPasswordServer(): Promise { - TEST_REDIS_SERVERS[TestRedisServers.PASSWORD] = { - socket: { - port: await spawnGlobalRedisServer(['--requirepass', 'password']), - }, - password: 'password' - }; - - if (isRedisVersionGreaterThan([6])) { - TEST_REDIS_SERVERS[TestRedisServers.PASSWORD].username = 'default'; - } -} - -async function spawnOpenCluster(): Promise { - TEST_REDIS_CLUSTERES[TestRedisClusters.OPEN] = { - rootNodes: (await spawnGlobalRedisCluster(TestRedisClusters.OPEN, 3)).map(port => ({ - socket: { - port - } - })) - }; -} - -before(function () { - this.timeout(10000); - - return Promise.all([ - spawnOpenServer(), - spawnPasswordServer(), - spawnOpenCluster() - ]); -}); - -interface RedisTestOptions { - minimumRedisVersion?: PartialRedisVersion; -} - -export function handleMinimumRedisVersion(mochaContext: MochaContext, minimumVersion: PartialRedisVersion | undefined): boolean { - if (isRedisVersionGreaterThan(minimumVersion)) { - return false; - } - - mochaContext.skip(); - return true; -} - -export function describeHandleMinimumRedisVersion(minimumVersion: PartialRedisVersion): void { - before(function () { - handleMinimumRedisVersion(this, minimumVersion); - }); -} - -interface RedisClientTestOptions extends RedisTestOptions { - clientOptions?: RedisClientOptions; -} - -export function itWithClient( - type: TestRedisServers, - title: string, - fn: (client: RedisClientType) => Promise, - options?: RedisClientTestOptions -): void { - it(title, async function () { - if (handleMinimumRedisVersion(this, options?.minimumRedisVersion)) return; - - const client = RedisClient.create({ - ...TEST_REDIS_SERVERS[type], - ...options?.clientOptions - }); - - await client.connect(); - - try { - await client.flushAll(); - await fn(client); - } finally { - await client.flushAll(); - await client.disconnect(); - } - }); -} - -export function itWithCluster( - type: TestRedisClusters, - title: string, - fn: (cluster: RedisClusterType) => Promise, - options?: RedisTestOptions -): void { - it(title, async function () { - if (handleMinimumRedisVersion(this, options?.minimumRedisVersion)) return; - - const cluster = RedisCluster.create(TEST_REDIS_CLUSTERES[type]); - - await cluster.connect(); - - try { - await clusterFlushAll(cluster); - await fn(cluster); - } finally { - await clusterFlushAll(cluster); - await cluster.disconnect(); - } - }); -} - -export function itWithDedicatedCluster(title: string, fn: (cluster: RedisClusterType) => Promise): void { - it(title, async function () { - this.timeout(10000); - - const spawnResults = await spawnRedisCluster(null, 3), - cluster = RedisCluster.create({ - rootNodes: [{ - socket: { - port: spawnResults[0].port - } - }] - }); - - await cluster.connect(); - - try { - await fn(cluster); - } finally { - await cluster.disconnect(); - - for (const { cleanup } of spawnResults) { - await cleanup(); - } - } - }); -} - -async function clusterFlushAll(cluster: RedisCluster): Promise { - await Promise.all( - cluster.getMasters().map(({ client }) => client.flushAll()) - ); -} - -export async function waitTillBeenCalled(spy: SinonSpy): Promise { - const start = process.hrtime.bigint(), - calls = spy.callCount; - - do { - if (process.hrtime.bigint() - start > 1_000_000_000) { - throw new Error('Waiting for more than 1 second'); - } - - await promiseTimeout(1); - } while (spy.callCount === calls) -} diff --git a/lib/test-utils/dockers.ts b/lib/test-utils/dockers.ts new file mode 100644 index 0000000000..3e48618ee4 --- /dev/null +++ b/lib/test-utils/dockers.ts @@ -0,0 +1,215 @@ +import { createConnection } from 'net'; +import { once } from 'events'; +import { RedisModules, RedisScripts } from '../commands'; +import RedisClient, { RedisClientType } from '../client'; +import { promiseTimeout } from '../utils'; +import { promisify } from 'util'; +import { exec } from 'child_process'; +const execAsync = promisify(exec); + +interface ErrorWithCode extends Error { + code: string; +} + +async function isPortAvailable(port: number): Promise { + try { + const socket = createConnection({ port }); + await once(socket, 'connect'); + socket.end(); + } catch (err) { + if (err instanceof Error && (err as ErrorWithCode).code === 'ECONNREFUSED') { + return true; + } + } + + return false; +} + +const portIterator = (async function*(): AsyncIterableIterator { + for (let i = 6379; i < 65535; i++) { + if (await isPortAvailable(i)) { + yield i; + } + } + + throw new Error('All ports are in use'); +})(); + +export interface RedisServerDockerConfig { + image: string; + version: Array; +} + +export interface RedisServerDocker { + port: number; + dockerId: string; +} + +async function spawnRedisServerDocker({ image, version }: RedisServerDockerConfig, serverArguments: Array): Promise { + const port = (await portIterator.next()).value, + { stdout, stderr } = await execAsync( + `docker run -d --network host ${image}:${version.join('.')} ` + + `--save --port ${port.toString()} ${serverArguments.join(' ')}` + ); + + if (!stdout) { + throw new Error(`docker run error - ${stderr}`); + } + + while (await isPortAvailable(port)) { + await promiseTimeout(500); + } + + return { + port, + dockerId: stdout.trim() + }; +} + +const RUNNING_SERVERS = new Map, ReturnType>(); + +export function spawnRedisServer(dockerConfig: RedisServerDockerConfig, serverArguments: Array): Promise { + const runningServer = RUNNING_SERVERS.get(serverArguments); + if (runningServer) { + return runningServer; + } + + const dockerPromise = spawnRedisServerDocker(dockerConfig, serverArguments); + RUNNING_SERVERS.set(serverArguments, dockerPromise); + return dockerPromise; +} + +async function dockerRemove(dockerId: string): Promise { + const { stderr } = await execAsync(`docker rm -f ${dockerId}`); + if (stderr) { + throw new Error(`docker rm error - ${stderr}`); + } +} + +after(() => { + return Promise.all( + [...RUNNING_SERVERS.values()].map(async dockerPromise => + await dockerRemove((await dockerPromise).dockerId) + ) + ); +}); + +export interface RedisClusterDockersConfig extends RedisServerDockerConfig { + numberOfNodes?: number; +} + +async function spawnRedisClusterNodeDocker( + dockersConfig: RedisClusterDockersConfig, + serverArguments: Array, + fromSlot: number, + toSlot: number, + waitForState: boolean, + meetPort?: number +): Promise { + const docker = await spawnRedisServerDocker(dockersConfig, [ + ...serverArguments, + '--cluster-enabled', + 'yes', + '--cluster-node-timeout', + '5000' + ]), + client = RedisClient.create({ + socket: { + port: docker.port + } + }); + + await client.connect(); + + try { + const range = []; + for (let i = fromSlot; i < toSlot; i++) { + range.push(i); + } + + const promises: Array> = [client.clusterAddSlots(range)]; + + if (meetPort) { + promises.push(client.clusterMeet('127.0.0.1', meetPort)); + } + + if (waitForState) { + promises.push(waitForClusterState(client)); + } + + await Promise.all(promises); + + return docker; + } finally { + await client.disconnect(); + } +} + +async function waitForClusterState(client: RedisClientType): Promise { + while ((await client.clusterInfo()).state !== 'ok') { + await promiseTimeout(500); + } +} + +const SLOTS = 16384; + +async function spawnRedisClusterDockers(dockersConfig: RedisClusterDockersConfig, serverArguments: Array): Promise> { + const numberOfNodes = dockersConfig.numberOfNodes ?? 3, + slotsPerNode = Math.floor(SLOTS / numberOfNodes), + dockers: Array = []; + for (let i = 0; i < numberOfNodes; i++) { + const fromSlot = i * slotsPerNode, + [ toSlot, waitForState ] = i === numberOfNodes - 1 ? [SLOTS, true] : [fromSlot + slotsPerNode, false]; + dockers.push( + await spawnRedisClusterNodeDocker( + dockersConfig, + serverArguments, + fromSlot, + toSlot, + waitForState, + i === 0 ? undefined : dockers[i - 1].port + ) + ); + } + + const client = RedisClient.create({ + socket: { + port: dockers[0].port + } + }); + + await client.connect(); + + try { + while ((await client.clusterInfo()).state !== 'ok') { + await promiseTimeout(500); + } + } finally { + await client.disconnect(); + } + + return dockers; +} + +const RUNNING_CLUSTERS = new Map, ReturnType>(); + +export function spawnRedisCluster(dockersConfig: RedisClusterDockersConfig, serverArguments: Array): Promise> { + const runningCluster = RUNNING_CLUSTERS.get(serverArguments); + if (runningCluster) { + return runningCluster; + } + + const dockersPromise = spawnRedisClusterDockers(dockersConfig, serverArguments); + RUNNING_CLUSTERS.set(serverArguments, dockersPromise); + return dockersPromise; +} + +after(() => { + return Promise.all( + [...RUNNING_CLUSTERS.values()].map(async dockersPromise => { + return Promise.all( + (await dockersPromise).map(({ dockerId }) => dockerRemove(dockerId)) + ); + }) + ); +}); diff --git a/lib/test-utils/index.ts b/lib/test-utils/index.ts new file mode 100644 index 0000000000..69bfc440c9 --- /dev/null +++ b/lib/test-utils/index.ts @@ -0,0 +1,49 @@ +import TestUtils from './test-utils'; +import { SinonSpy } from 'sinon'; +import { promiseTimeout } from '../utils'; + +export default new TestUtils({ + defaultDockerVersion: '6.2', + dockerImageName: 'redis', + dockerImageVersionArgument: 'redis-version' +}); + +export const GLOBAL = { + SERVERS: { + OPEN: { + serverArguments: [] + }, + PASSWORD: { + serverArguments: ['--requirepass', 'password'], + clientOptions: { + password: 'password' + } + } + }, + CLUSTERS: { + OPEN: { + serverArguments: [] + }, + PASSWORD: { + serverArguments: ['--requirepass', 'password'], + clusterConfiguration: { + defaults: { + password: 'password' + } + } + } + } +}; + +export async function waitTillBeenCalled(spy: SinonSpy): Promise { + const start = process.hrtime.bigint(), + calls = spy.callCount; + + do { + if (process.hrtime.bigint() - start > 1_000_000_000) { + throw new Error('Waiting for more than 1 second'); + } + + await promiseTimeout(1); + } while (spy.callCount === calls); +} diff --git a/lib/test-utils/test-utils.ts b/lib/test-utils/test-utils.ts new file mode 100644 index 0000000000..7e48870271 --- /dev/null +++ b/lib/test-utils/test-utils.ts @@ -0,0 +1,175 @@ +import { RedisModules, RedisScripts } from '../commands'; +import RedisClient, { RedisClientOptions, RedisClientType } from '../client'; +import RedisCluster, { RedisClusterOptions, RedisClusterType } from '../cluster'; +import { RedisServerDockerConfig, spawnRedisServer, spawnRedisCluster } from './dockers'; +import yargs from 'yargs'; +import { hideBin } from 'yargs/helpers'; + +interface CommonTestOptions { + minimumDockerVersion?: Array; +} + +interface ClientTestOptions extends CommonTestOptions { + serverArguments: Array; + clientOptions?: Partial>; + disableClientSetup?: boolean; +} + +interface ClusterTestOptions extends CommonTestOptions { + serverArguments: Array; + clusterConfiguration?: Partial>; +} + +interface TestsUtilsConfig { + dockerImageName: string; + dockerImageVersionArgument: string; + defaultDockerVersion: string; +} + +export default class TestUtils { + static #getVersion(config: TestsUtilsConfig): Array { + return yargs(hideBin(process.argv)) + .option('redis-version', { + type: 'string', + default: config.defaultDockerVersion + }) + .coerce(config.dockerImageVersionArgument, (arg: string) => { + return arg.split('.').map(x => { + const value = Number(x); + if (Number.isNaN(value)) { + throw new TypeError(`${arg} is not a valid redis version`); + } + + return value; + }); + }) + .demandOption(config.dockerImageVersionArgument) + .parseSync()[config.dockerImageVersionArgument]; + } + + readonly #DOCKER_IMAGE: RedisServerDockerConfig; + + constructor(config: TestsUtilsConfig) { + this.#DOCKER_IMAGE = { + image: config.dockerImageName, + version: TestUtils.#getVersion(config) + }; + } + + isVersionGreaterThan(minimumVersion: Array | undefined): boolean { + if (minimumVersion === undefined) return true; + + const lastIndex = Math.min(this.#DOCKER_IMAGE.version.length, minimumVersion.length) - 1; + for (let i = 0; i < lastIndex; i++) { + if (this.#DOCKER_IMAGE.version[i] > minimumVersion[i]) { + return true; + } else if (minimumVersion[i] > this.#DOCKER_IMAGE.version[i]) { + return false; + } + } + + return this.#DOCKER_IMAGE.version[lastIndex] >= minimumVersion[lastIndex]; + } + + isVersionGreaterThanHook(minimumVersion: Array | undefined): void { + const isVersionGreaterThan = this.isVersionGreaterThan.bind(this); + before(function () { + if (!isVersionGreaterThan(minimumVersion)) { + return this.skip(); + } + }); + } + + testWithClient( + title: string, + fn: (client: RedisClientType) => Promise, + options: ClientTestOptions + ): Mocha.Test { + let dockerPromise: ReturnType; + if (this.isVersionGreaterThan(options.minimumDockerVersion)) { + const dockerImage = this.#DOCKER_IMAGE; + before(function () { + this.timeout(5000); + + dockerPromise = spawnRedisServer(dockerImage, options.serverArguments); + return dockerPromise; + }); + } + + return it(title, async function() { + if (!dockerPromise) return this.skip(); + + const client = RedisClient.create({ + ...options?.clientOptions, + socket: { + ...options?.clientOptions?.socket, + port: (await dockerPromise).port + } + }); + + if (options.disableClientSetup) { + return fn(client); + } + + try { + await client.connect(); + await client.flushAll(); + + await fn(client); + } finally { + if (client.isOpen) { + await client.flushAll(); + await client.disconnect(); + } + } + }); + } + + static async #clusterFlushAll(cluster: RedisClusterType): Promise { + await Promise.all( + cluster.getMasters().map(({ client }) => client.flushAll()) + ); + } + + testWithCluster( + title: string, + fn: (cluster: RedisClusterType) => Promise, + options: ClusterTestOptions + ): Mocha.Test { + let dockersPromise: ReturnType; + if (this.isVersionGreaterThan(options.minimumDockerVersion)) { + const dockerImage = this.#DOCKER_IMAGE; + before(function () { + this.timeout(10000); + + dockersPromise = spawnRedisCluster(dockerImage, options.serverArguments); + return dockersPromise; + }); + } + + return it(title, async function () { + if (!dockersPromise) return this.skip(); + + const dockers = await dockersPromise, + cluster = RedisCluster.create({ + ...options.clusterConfiguration, + rootNodes: dockers.map(({ port }) => ({ + socket: { + port + } + })) + }); + + + await cluster.connect(); + + try { + await TestUtils.#clusterFlushAll(cluster); + await fn(cluster); + } finally { + await TestUtils.#clusterFlushAll(cluster); + await cluster.disconnect(); + } + }); + } +} diff --git a/package-lock.json b/package-lock.json index 520aedc327..ff1b2e6e56 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,65 +18,65 @@ "@istanbuljs/nyc-config-typescript": "^1.0.1", "@tsconfig/node12": "^1.0.9", "@types/mocha": "^9.0.0", - "@types/node": "^16.11.1", - "@types/sinon": "^10.0.4", - "@types/which": "^2.0.1", + "@types/node": "^16.11.6", + "@types/sinon": "^10.0.6", "@types/yallist": "^4.0.1", - "@typescript-eslint/eslint-plugin": "^5.1.0", - "@typescript-eslint/parser": "^5.1.0", - "eslint": "^8.0.1", + "@types/yargs": "^17.0.5", + "@typescript-eslint/eslint-plugin": "^5.2.0", + "@typescript-eslint/parser": "^5.2.0", + "eslint": "^8.1.0", "mocha": "^9.1.3", "nyc": "^15.1.0", "release-it": "^14.11.6", "sinon": "^11.1.2", "source-map-support": "^0.5.20", - "ts-node": "^10.3.0", - "typedoc": "^0.22.6", + "ts-node": "^10.4.0", + "typedoc": "^0.22.7", "typedoc-github-wiki-theme": "^0.6.0", "typedoc-plugin-markdown": "^3.11.3", "typescript": "^4.4.4", - "which": "^2.0.2" + "yargs": "^17.2.1" }, "engines": { "node": ">=12" } }, "node_modules/@babel/code-frame": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.15.8.tgz", - "integrity": "sha512-2IAnmn8zbvC/jKYhq5Ki9I+DwjlrtMPUCH/CpHvqI4dNnlwHwsxoIhlc8WcYY5LSYknXQtAlFYuHfqAFCvQ4Wg==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.0.tgz", + "integrity": "sha512-IF4EOMEV+bfYwOmNxGzSnjR2EmQod7f1UXOpZM3l4i4o4QNwzjtJAu/HxdjHq0aYBvdqMuQEY1eg0nqW9ZPORA==", "dev": true, "dependencies": { - "@babel/highlight": "^7.14.5" + "@babel/highlight": "^7.16.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/compat-data": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.15.0.tgz", - "integrity": "sha512-0NqAC1IJE0S0+lL1SWFMxMkz1pKCNCjI4tr2Zx4LJSXxCLAdr6KyArnY+sno5m3yH9g737ygOyPABDsnXkpxiA==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.16.0.tgz", + "integrity": "sha512-DGjt2QZse5SGd9nfOSqO4WLJ8NN/oHkijbXbPrxuoJO3oIPJL3TciZs9FX+cOHNiY9E9l0opL8g7BmLe3T+9ew==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.15.8.tgz", - "integrity": "sha512-3UG9dsxvYBMYwRv+gS41WKHno4K60/9GPy1CJaH6xy3Elq8CTtvtjT5R5jmNhXfCYLX2mTw+7/aq5ak/gOE0og==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.0.tgz", + "integrity": "sha512-mYZEvshBRHGsIAiyH5PzCFTCfbWfoYbO/jcSdXQSUQu1/pW0xDZAUP7KEc32heqWTAfAHhV9j1vH8Sav7l+JNQ==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.15.8", - "@babel/generator": "^7.15.8", - "@babel/helper-compilation-targets": "^7.15.4", - "@babel/helper-module-transforms": "^7.15.8", - "@babel/helpers": "^7.15.4", - "@babel/parser": "^7.15.8", - "@babel/template": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.6", + "@babel/code-frame": "^7.16.0", + "@babel/generator": "^7.16.0", + "@babel/helper-compilation-targets": "^7.16.0", + "@babel/helper-module-transforms": "^7.16.0", + "@babel/helpers": "^7.16.0", + "@babel/parser": "^7.16.0", + "@babel/template": "^7.16.0", + "@babel/traverse": "^7.16.0", + "@babel/types": "^7.16.0", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -102,12 +102,12 @@ } }, "node_modules/@babel/generator": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.15.8.tgz", - "integrity": "sha512-ECmAKstXbp1cvpTTZciZCgfOt6iN64lR0d+euv3UZisU5awfRawOvg07Utn/qBGuH4bRIEZKrA/4LzZyXhZr8g==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.16.0.tgz", + "integrity": "sha512-RR8hUCfRQn9j9RPKEVXo9LiwoxLPYn6hNZlvUOR8tSnaxlD0p0+la00ZP9/SnRt6HchKr+X0fO2r8vrETiJGew==", "dev": true, "dependencies": { - "@babel/types": "^7.15.6", + "@babel/types": "^7.16.0", "jsesc": "^2.5.1", "source-map": "^0.5.0" }, @@ -116,12 +116,12 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.15.4.tgz", - "integrity": "sha512-rMWPCirulnPSe4d+gwdWXLfAXTTBj8M3guAf5xFQJ0nvFY7tfNAFnWdqaHegHlgDZOCT4qvhF3BYlSJag8yhqQ==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.0.tgz", + "integrity": "sha512-S7iaOT1SYlqK0sQaCi21RX4+13hmdmnxIEAnQUB/eh7GeAnRjOUgTYpLkUOiRXzD+yog1JxP0qyAQZ7ZxVxLVg==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.15.0", + "@babel/compat-data": "^7.16.0", "@babel/helper-validator-option": "^7.14.5", "browserslist": "^4.16.6", "semver": "^6.3.0" @@ -143,132 +143,132 @@ } }, "node_modules/@babel/helper-function-name": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.15.4.tgz", - "integrity": "sha512-Z91cOMM4DseLIGOnog+Z8OI6YseR9bua+HpvLAQ2XayUGU+neTtX+97caALaLdyu53I/fjhbeCnWnRH1O3jFOw==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.0.tgz", + "integrity": "sha512-BZh4mEk1xi2h4HFjWUXRQX5AEx4rvaZxHgax9gcjdLWdkjsY7MKt5p0otjsg5noXw+pB+clMCjw+aEVYADMjog==", "dev": true, "dependencies": { - "@babel/helper-get-function-arity": "^7.15.4", - "@babel/template": "^7.15.4", - "@babel/types": "^7.15.4" + "@babel/helper-get-function-arity": "^7.16.0", + "@babel/template": "^7.16.0", + "@babel/types": "^7.16.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-get-function-arity": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.15.4.tgz", - "integrity": "sha512-1/AlxSF92CmGZzHnC515hm4SirTxtpDnLEJ0UyEMgTMZN+6bxXKg04dKhiRx5Enel+SUA1G1t5Ed/yQia0efrA==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.0.tgz", + "integrity": "sha512-ASCquNcywC1NkYh/z7Cgp3w31YW8aojjYIlNg4VeJiHkqyP4AzIvr4qx7pYDb4/s8YcsZWqqOSxgkvjUz1kpDQ==", "dev": true, "dependencies": { - "@babel/types": "^7.15.4" + "@babel/types": "^7.16.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-hoist-variables": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.15.4.tgz", - "integrity": "sha512-VTy085egb3jUGVK9ycIxQiPbquesq0HUQ+tPO0uv5mPEBZipk+5FkRKiWq5apuyTE9FUrjENB0rCf8y+n+UuhA==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.0.tgz", + "integrity": "sha512-1AZlpazjUR0EQZQv3sgRNfM9mEVWPK3M6vlalczA+EECcPz3XPh6VplbErL5UoMpChhSck5wAJHthlj1bYpcmg==", "dev": true, "dependencies": { - "@babel/types": "^7.15.4" + "@babel/types": "^7.16.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-member-expression-to-functions": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.15.4.tgz", - "integrity": "sha512-cokOMkxC/BTyNP1AlY25HuBWM32iCEsLPI4BHDpJCHHm1FU2E7dKWWIXJgQgSFiu4lp8q3bL1BIKwqkSUviqtA==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.16.0.tgz", + "integrity": "sha512-bsjlBFPuWT6IWhl28EdrQ+gTvSvj5tqVP5Xeftp07SEuz5pLnsXZuDkDD3Rfcxy0IsHmbZ+7B2/9SHzxO0T+sQ==", "dev": true, "dependencies": { - "@babel/types": "^7.15.4" + "@babel/types": "^7.16.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-imports": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.15.4.tgz", - "integrity": "sha512-jeAHZbzUwdW/xHgHQ3QmWR4Jg6j15q4w/gCfwZvtqOxoo5DKtLHk8Bsf4c5RZRC7NmLEs+ohkdq8jFefuvIxAA==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.0.tgz", + "integrity": "sha512-kkH7sWzKPq0xt3H1n+ghb4xEMP8k0U7XV3kkB+ZGy69kDk2ySFW1qPi06sjKzFY3t1j6XbJSqr4mF9L7CYVyhg==", "dev": true, "dependencies": { - "@babel/types": "^7.15.4" + "@babel/types": "^7.16.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.15.8.tgz", - "integrity": "sha512-DfAfA6PfpG8t4S6npwzLvTUpp0sS7JrcuaMiy1Y5645laRJIp/LiLGIBbQKaXSInK8tiGNI7FL7L8UvB8gdUZg==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.0.tgz", + "integrity": "sha512-My4cr9ATcaBbmaEa8M0dZNA74cfI6gitvUAskgDtAFmAqyFKDSHQo5YstxPbN+lzHl2D9l/YOEFqb2mtUh4gfA==", "dev": true, "dependencies": { - "@babel/helper-module-imports": "^7.15.4", - "@babel/helper-replace-supers": "^7.15.4", - "@babel/helper-simple-access": "^7.15.4", - "@babel/helper-split-export-declaration": "^7.15.4", + "@babel/helper-module-imports": "^7.16.0", + "@babel/helper-replace-supers": "^7.16.0", + "@babel/helper-simple-access": "^7.16.0", + "@babel/helper-split-export-declaration": "^7.16.0", "@babel/helper-validator-identifier": "^7.15.7", - "@babel/template": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.6" + "@babel/template": "^7.16.0", + "@babel/traverse": "^7.16.0", + "@babel/types": "^7.16.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-optimise-call-expression": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.15.4.tgz", - "integrity": "sha512-E/z9rfbAOt1vDW1DR7k4SzhzotVV5+qMciWV6LaG1g4jeFrkDlJedjtV4h0i4Q/ITnUu+Pk08M7fczsB9GXBDw==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.16.0.tgz", + "integrity": "sha512-SuI467Gi2V8fkofm2JPnZzB/SUuXoJA5zXe/xzyPP2M04686RzFKFHPK6HDVN6JvWBIEW8tt9hPR7fXdn2Lgpw==", "dev": true, "dependencies": { - "@babel/types": "^7.15.4" + "@babel/types": "^7.16.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-replace-supers": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.15.4.tgz", - "integrity": "sha512-/ztT6khaXF37MS47fufrKvIsiQkx1LBRvSJNzRqmbyeZnTwU9qBxXYLaaT/6KaxfKhjs2Wy8kG8ZdsFUuWBjzw==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.16.0.tgz", + "integrity": "sha512-TQxuQfSCdoha7cpRNJvfaYxxxzmbxXw/+6cS7V02eeDYyhxderSoMVALvwupA54/pZcOTtVeJ0xccp1nGWladA==", "dev": true, "dependencies": { - "@babel/helper-member-expression-to-functions": "^7.15.4", - "@babel/helper-optimise-call-expression": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.4" + "@babel/helper-member-expression-to-functions": "^7.16.0", + "@babel/helper-optimise-call-expression": "^7.16.0", + "@babel/traverse": "^7.16.0", + "@babel/types": "^7.16.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-simple-access": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.15.4.tgz", - "integrity": "sha512-UzazrDoIVOZZcTeHHEPYrr1MvTR/K+wgLg6MY6e1CJyaRhbibftF6fR2KU2sFRtI/nERUZR9fBd6aKgBlIBaPg==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.0.tgz", + "integrity": "sha512-o1rjBT/gppAqKsYfUdfHq5Rk03lMQrkPHG1OWzHWpLgVXRH4HnMM9Et9CVdIqwkCQlobnGHEJMsgWP/jE1zUiw==", "dev": true, "dependencies": { - "@babel/types": "^7.15.4" + "@babel/types": "^7.16.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-split-export-declaration": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.15.4.tgz", - "integrity": "sha512-HsFqhLDZ08DxCpBdEVtKmywj6PQbwnF6HHybur0MAnkAKnlS6uHkwnmRIkElB2Owpfb4xL4NwDmDLFubueDXsw==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.0.tgz", + "integrity": "sha512-0YMMRpuDFNGTHNRiiqJX19GjNXA4H0E8jZ2ibccfSxaCogbm3am5WN/2nQNj0YnQwGWM1J06GOcQ2qnh3+0paw==", "dev": true, "dependencies": { - "@babel/types": "^7.15.4" + "@babel/types": "^7.16.0" }, "engines": { "node": ">=6.9.0" @@ -293,26 +293,26 @@ } }, "node_modules/@babel/helpers": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.15.4.tgz", - "integrity": "sha512-V45u6dqEJ3w2rlryYYXf6i9rQ5YMNu4FLS6ngs8ikblhu2VdR1AqAd6aJjBzmf2Qzh6KOLqKHxEN9+TFbAkAVQ==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.16.0.tgz", + "integrity": "sha512-dVRM0StFMdKlkt7cVcGgwD8UMaBfWJHl3A83Yfs8GQ3MO0LHIIIMvK7Fa0RGOGUQ10qikLaX6D7o5htcQWgTMQ==", "dev": true, "dependencies": { - "@babel/template": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.4" + "@babel/template": "^7.16.0", + "@babel/traverse": "^7.16.0", + "@babel/types": "^7.16.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.5.tgz", - "integrity": "sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.0.tgz", + "integrity": "sha512-t8MH41kUQylBtu2+4IQA3atqevA2lRgqA2wyVB/YiWmsDSuylZZuXOUy9ric30hfzauEFfdsuk/eXTRrGrfd0g==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.14.5", + "@babel/helper-validator-identifier": "^7.15.7", "chalk": "^2.0.0", "js-tokens": "^4.0.0" }, @@ -392,9 +392,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.15.8.tgz", - "integrity": "sha512-BRYa3wcQnjS/nqI8Ac94pYYpJfojHVvVXJ97+IDCImX4Jc8W8Xv1+47enbruk+q1etOpsQNwnfFcNGw+gtPGxA==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.0.tgz", + "integrity": "sha512-TEHWXf0xxpi9wKVyBCmRcSSDjbJ/cl6LUdlbYUHEaNQUJGhreJbZrXT6sR4+fZLxVUJqNRB4KyOvjuy/D9009A==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -404,32 +404,32 @@ } }, "node_modules/@babel/template": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.15.4.tgz", - "integrity": "sha512-UgBAfEa1oGuYgDIPM2G+aHa4Nlo9Lh6mGD2bDBGMTbYnc38vulXPuC1MGjYILIEmlwl6Rd+BPR9ee3gm20CBtg==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.0.tgz", + "integrity": "sha512-MnZdpFD/ZdYhXwiunMqqgyZyucaYsbL0IrjoGjaVhGilz+x8YB++kRfygSOIj1yOtWKPlx7NBp+9I1RQSgsd5A==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.14.5", - "@babel/parser": "^7.15.4", - "@babel/types": "^7.15.4" + "@babel/code-frame": "^7.16.0", + "@babel/parser": "^7.16.0", + "@babel/types": "^7.16.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.15.4.tgz", - "integrity": "sha512-W6lQD8l4rUbQR/vYgSuCAE75ADyyQvOpFVsvPPdkhf6lATXAsQIG9YdtOcu8BB1dZ0LKu+Zo3c1wEcbKeuhdlA==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.0.tgz", + "integrity": "sha512-qQ84jIs1aRQxaGaxSysII9TuDaguZ5yVrEuC0BN2vcPlalwfLovVmCjbFDPECPXcYM/wLvNFfp8uDOliLxIoUQ==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.14.5", - "@babel/generator": "^7.15.4", - "@babel/helper-function-name": "^7.15.4", - "@babel/helper-hoist-variables": "^7.15.4", - "@babel/helper-split-export-declaration": "^7.15.4", - "@babel/parser": "^7.15.4", - "@babel/types": "^7.15.4", + "@babel/code-frame": "^7.16.0", + "@babel/generator": "^7.16.0", + "@babel/helper-function-name": "^7.16.0", + "@babel/helper-hoist-variables": "^7.16.0", + "@babel/helper-split-export-declaration": "^7.16.0", + "@babel/parser": "^7.16.0", + "@babel/types": "^7.16.0", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -447,12 +447,12 @@ } }, "node_modules/@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.16.0.tgz", + "integrity": "sha512-PJgg/k3SdLsGb3hhisFvtLOw5ts113klrpLuIPtCJIU+BB24fqq6lf8RWqKJEjzqXR9AEH1rIb5XTqwBHB+kQg==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.14.9", + "@babel/helper-validator-identifier": "^7.15.7", "to-fast-properties": "^2.0.0" }, "engines": { @@ -972,9 +972,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "16.11.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.1.tgz", - "integrity": "sha512-PYGcJHL9mwl1Ek3PLiYgyEKtwTMmkMw4vbiyz/ps3pfdRYLVv+SN7qHVAImrjdAXxgluDEw6Ph4lyv+m9UpRmA==", + "version": "16.11.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.6.tgz", + "integrity": "sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==", "dev": true }, "node_modules/@types/parse-json": { @@ -993,34 +993,43 @@ } }, "node_modules/@types/sinon": { - "version": "10.0.4", - "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.4.tgz", - "integrity": "sha512-fOYjrxQv8zJsqOY6V6ecP4eZhQBxtY80X0er1VVnUIAIZo74jHm8e1vguG5Yt4Iv8W2Wr7TgibB8MfRe32k9pA==", + "version": "10.0.6", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.6.tgz", + "integrity": "sha512-6EF+wzMWvBNeGrfP3Nx60hhx+FfwSg1JJBLAAP/IdIUq0EYkqCYf70VT3PhuhPX9eLD+Dp+lNdpb/ZeHG8Yezg==", "dev": true, "dependencies": { "@sinonjs/fake-timers": "^7.1.0" } }, - "node_modules/@types/which": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@types/which/-/which-2.0.1.tgz", - "integrity": "sha512-Jjakcv8Roqtio6w1gr0D7y6twbhx6gGgFGF5BLwajPpnOIOxFkakFhCq+LmyyeAz7BX6ULrjBOxdKaCDy+4+dQ==", - "dev": true - }, "node_modules/@types/yallist": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@types/yallist/-/yallist-4.0.1.tgz", "integrity": "sha512-G3FNJfaYtN8URU6wd6+uwFI62KO79j7n3XTYcwcFncP8gkfoi0b821GoVVt0oqKVnCqKYOMNKIGpakPoFhzAGA==", "dev": true }, - "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.1.0.tgz", - "integrity": "sha512-bekODL3Tqf36Yz8u+ilha4zGxL9mdB6LIsIoMAvvC5FAuWo4NpZYXtCbv7B2CeR1LhI/lLtLk+q4tbtxuoVuCg==", + "node_modules/@types/yargs": { + "version": "17.0.5", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.5.tgz", + "integrity": "sha512-4HNq144yhaVjJs+ON6A07NEoi9Hh0Rhl/jI9Nt/l/YRjt+T6St/QK3meFARWZ8IgkzoD1LC0PdTdJenlQQi2WQ==", "dev": true, "dependencies": { - "@typescript-eslint/experimental-utils": "5.1.0", - "@typescript-eslint/scope-manager": "5.1.0", + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "20.2.1", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-20.2.1.tgz", + "integrity": "sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw==", + "dev": true + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.2.0.tgz", + "integrity": "sha512-qQwg7sqYkBF4CIQSyRQyqsYvP+g/J0To9ZPVNJpfxfekl5RmdvQnFFTVVwpRtaUDFNvjfe/34TgY/dpc3MgNTw==", + "dev": true, + "dependencies": { + "@typescript-eslint/experimental-utils": "5.2.0", + "@typescript-eslint/scope-manager": "5.2.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -1046,15 +1055,15 @@ } }, "node_modules/@typescript-eslint/experimental-utils": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.1.0.tgz", - "integrity": "sha512-ovE9qUiZMOMgxQAESZsdBT+EXIfx/YUYAbwGUI6V03amFdOOxI9c6kitkgRvLkJaLusgMZ2xBhss+tQ0Y1HWxA==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.2.0.tgz", + "integrity": "sha512-fWyT3Agf7n7HuZZRpvUYdFYbPk3iDCq6fgu3ulia4c7yxmPnwVBovdSOX7RL+k8u6hLbrXcdAehlWUVpGh6IEw==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.1.0", - "@typescript-eslint/types": "5.1.0", - "@typescript-eslint/typescript-estree": "5.1.0", + "@typescript-eslint/scope-manager": "5.2.0", + "@typescript-eslint/types": "5.2.0", + "@typescript-eslint/typescript-estree": "5.2.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" }, @@ -1070,14 +1079,14 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.1.0.tgz", - "integrity": "sha512-vx1P+mhCtYw3+bRHmbalq/VKP2Y3gnzNgxGxfEWc6OFpuEL7iQdAeq11Ke3Rhy8NjgB+AHsIWEwni3e+Y7djKA==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.2.0.tgz", + "integrity": "sha512-Uyy4TjJBlh3NuA8/4yIQptyJb95Qz5PX//6p8n7zG0QnN4o3NF9Je3JHbVU7fxf5ncSXTmnvMtd/LDQWDk0YqA==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.1.0", - "@typescript-eslint/types": "5.1.0", - "@typescript-eslint/typescript-estree": "5.1.0", + "@typescript-eslint/scope-manager": "5.2.0", + "@typescript-eslint/types": "5.2.0", + "@typescript-eslint/typescript-estree": "5.2.0", "debug": "^4.3.2" }, "engines": { @@ -1097,13 +1106,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.1.0.tgz", - "integrity": "sha512-yYlyVjvn5lvwCL37i4hPsa1s0ORsjkauhTqbb8MnpvUs7xykmcjGqwlNZ2Q5QpoqkJ1odlM2bqHqJwa28qV6Tw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.2.0.tgz", + "integrity": "sha512-RW+wowZqPzQw8MUFltfKYZfKXqA2qgyi6oi/31J1zfXJRpOn6tCaZtd9b5u9ubnDG2n/EMvQLeZrsLNPpaUiFQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.1.0", - "@typescript-eslint/visitor-keys": "5.1.0" + "@typescript-eslint/types": "5.2.0", + "@typescript-eslint/visitor-keys": "5.2.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1114,9 +1123,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.1.0.tgz", - "integrity": "sha512-sEwNINVxcB4ZgC6Fe6rUyMlvsB2jvVdgxjZEjQUQVlaSPMNamDOwO6/TB98kFt4sYYfNhdhTPBEQqNQZjMMswA==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.2.0.tgz", + "integrity": "sha512-cTk6x08qqosps6sPyP2j7NxyFPlCNsJwSDasqPNjEQ8JMD5xxj2NHxcLin5AJQ8pAVwpQ8BMI3bTxR0zxmK9qQ==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1127,13 +1136,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.1.0.tgz", - "integrity": "sha512-SSz+l9YrIIsW4s0ZqaEfnjl156XQ4VRmJsbA0ZE1XkXrD3cRpzuZSVCyqeCMR3EBjF27IisWakbBDGhGNIOvfQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.2.0.tgz", + "integrity": "sha512-RsdXq2XmVgKbm9nLsE3mjNUM7BTr/K4DYR9WfFVMUuozHWtH5gMpiNZmtrMG8GR385EOSQ3kC9HiEMJWimxd/g==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.1.0", - "@typescript-eslint/visitor-keys": "5.1.0", + "@typescript-eslint/types": "5.2.0", + "@typescript-eslint/visitor-keys": "5.2.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -1154,12 +1163,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.1.0.tgz", - "integrity": "sha512-uqNXepKBg81JVwjuqAxYrXa1Ql/YDzM+8g/pS+TCPxba0wZttl8m5DkrasbfnmJGHs4lQ2jTbcZ5azGhI7kK+w==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.2.0.tgz", + "integrity": "sha512-Nk7HizaXWWCUBfLA/rPNKMzXzWS8Wg9qHMuGtT+v2/YpPij4nVXrVJc24N/r5WrrmqK31jCrZxeHqIgqRzs0Xg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.1.0", + "@typescript-eslint/types": "5.2.0", "eslint-visitor-keys": "^3.0.0" }, "engines": { @@ -1486,15 +1495,15 @@ "dev": true }, "node_modules/browserslist": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.4.tgz", - "integrity": "sha512-Zg7RpbZpIJRW3am9Lyckue7PLytvVxxhJj1CaJVlCWENsGEAOlnlt8X0ZxGRPp7Bt9o8tIRM5SEXy4BCPMJjLQ==", + "version": "4.17.5", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.5.tgz", + "integrity": "sha512-I3ekeB92mmpctWBoLXe0d5wPS2cBuRvvW0JyyJHMrk9/HmP2ZjrTboNAZ8iuGqaEIlKguljbQY32OkOJIRrgoA==", "dev": true, "dependencies": { - "caniuse-lite": "^1.0.30001265", - "electron-to-chromium": "^1.3.867", + "caniuse-lite": "^1.0.30001271", + "electron-to-chromium": "^1.3.878", "escalade": "^3.1.1", - "node-releases": "^2.0.0", + "node-releases": "^2.0.1", "picocolors": "^1.0.0" }, "bin": { @@ -1627,9 +1636,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001269", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001269.tgz", - "integrity": "sha512-UOy8okEVs48MyHYgV+RdW1Oiudl1H6KolybD6ZquD0VcrPSgj25omXO1S7rDydjpqaISCwA8Pyx+jUQKZwWO5w==", + "version": "1.0.30001274", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001274.tgz", + "integrity": "sha512-+Nkvv0fHyhISkiMIjnyjmf5YJcQ1IQHZN6U9TLUMroWR38FNwpsC51Gb68yueafX1V6ifOisInSgP9WJFS13ew==", "dev": true, "funding": { "type": "opencollective", @@ -2088,9 +2097,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.3.872", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.872.tgz", - "integrity": "sha512-qG96atLFY0agKyEETiBFNhpRLSXGSXOBuhXWpbkYqrLKKASpRyRBUtfkn0ZjIf/yXfA7FA4nScVOMpXSHFlUCQ==", + "version": "1.3.885", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.885.tgz", + "integrity": "sha512-JXKFJcVWrdHa09n4CNZYfYaK6EW5aAew7/wr3L1OnsD1L+JHL+RCtd7QgIsxUbFPeTwPlvnpqNNTOLkoefmtXg==", "dev": true }, "node_modules/emoji-regex": { @@ -2166,9 +2175,9 @@ } }, "node_modules/eslint": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.0.1.tgz", - "integrity": "sha512-LsgcwZgQ72vZ+SMp4K6pAnk2yFDWL7Ti4pJaRvsZ0Hsw2h8ZjUIW38a9AFn2cZXdBMlScMFYYgsSp4ttFI/0bA==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.1.0.tgz", + "integrity": "sha512-JZvNneArGSUsluHWJ8g8MMs3CfIEzwaLx9KyH4tZ2i+R2/rPWzL8c0zg3rHdwYVpN/1sB9gqnjHwz9HoeJpGHw==", "dev": true, "dependencies": { "@eslint/eslintrc": "^1.0.3", @@ -2283,9 +2292,9 @@ } }, "node_modules/eslint/node_modules/estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, "engines": { "node": ">=4.0" @@ -2340,9 +2349,9 @@ } }, "node_modules/esquery/node_modules/estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, "engines": { "node": ">=4.0" @@ -2361,9 +2370,9 @@ } }, "node_modules/esrecurse/node_modules/estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, "engines": { "node": ">=4.0" @@ -2804,9 +2813,9 @@ } }, "node_modules/globals": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.11.0.tgz", - "integrity": "sha512-08/xrJ7wQjK9kkkRoI3OFUBbLx4f+6x3SGwcPvQ0QH6goFDrOU2oyAWrmh3dJezu65buo+HBMzAMQy6rovVC3g==", + "version": "13.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz", + "integrity": "sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -3636,9 +3645,9 @@ "dev": true }, "node_modules/keyv": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.0.3.tgz", - "integrity": "sha512-zdGa2TOpSZPq5mU6iowDARnMBZgtCqJ11dJROFi6tg6kTn4nuUdU09lFyLFSaHrWqpIJ+EBq4E8/Dc0Vx5vLdA==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.0.4.tgz", + "integrity": "sha512-vqNHbAc8BBsxk+7QBYLW0Y219rWcClspR6WSeoHYKG5mnsSoOH+BL1pWq02DDCVdvvuUny5rkBlzMRzoqc+GIg==", "dev": true, "dependencies": { "json-buffer": "3.0.1" @@ -3800,9 +3809,9 @@ "dev": true }, "node_modules/marked": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/marked/-/marked-3.0.7.tgz", - "integrity": "sha512-ctKqbnLuNbsHbI26cfMyOlKgXGfl1orOv1AvWWDX7AkgfMOwCWvmuYc+mVLeWhQ9W6hdWVBynOs96VkcscKo0Q==", + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/marked/-/marked-3.0.8.tgz", + "integrity": "sha512-0gVrAjo5m0VZSJb4rpL59K1unJAMb/hm8HRXqasD8VeC8m91ytDPMritgFSlKonfdt+rRYYpP/JfLxgIX8yoSw==", "dev": true, "bin": { "marked": "bin/marked" @@ -3960,6 +3969,24 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, + "node_modules/mocha/node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -4031,9 +4058,9 @@ } }, "node_modules/node-fetch": { - "version": "2.6.5", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz", - "integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==", + "version": "2.6.6", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz", + "integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==", "dev": true, "dependencies": { "whatwg-url": "^5.0.0" @@ -4055,9 +4082,9 @@ } }, "node_modules/node-releases": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.0.tgz", - "integrity": "sha512-aA87l0flFYMzCHpTM3DERFSYxc6lv/BltdbRTOMZuxZ0cwZCD3mejE5n9vLhSJCN++/eOqr77G1IO5uXxlQYWA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz", + "integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==", "dev": true }, "node_modules/normalize-path": { @@ -5737,9 +5764,9 @@ "dev": true }, "node_modules/ts-node": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.3.0.tgz", - "integrity": "sha512-RYIy3i8IgpFH45AX4fQHExrT8BxDeKTdC83QFJkNzkvt8uFB6QJ8XMyhynYiKMLxt9a7yuXaDBZNOYS3XjDcYw==", + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.4.0.tgz", + "integrity": "sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==", "dev": true, "dependencies": { "@cspotcode/source-map-support": "0.7.0", @@ -5856,16 +5883,16 @@ } }, "node_modules/typedoc": { - "version": "0.22.6", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.22.6.tgz", - "integrity": "sha512-ePbJqOaz0GNkU2ehRwFwBpLD4Gp6m7jbJfHysXmDdjVKc1g8DFJ83r/LOZ9TZrkC661vgpoIY3FjSPEtUilHNA==", + "version": "0.22.7", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.22.7.tgz", + "integrity": "sha512-ndxxp+tU1Wczvdxp4u2/PvT1qjD6hdFdSdehpORHjE+JXmMkl2bftXCR0upHmsnesBG7VCcr8vfgloGHIH8glQ==", "dev": true, "dependencies": { "glob": "^7.2.0", "lunr": "^2.3.9", - "marked": "^3.0.4", + "marked": "^3.0.8", "minimatch": "^3.0.4", - "shiki": "^0.9.11" + "shiki": "^0.9.12" }, "bin": { "typedoc": "bin/typedoc" @@ -6273,9 +6300,9 @@ } }, "node_modules/yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "version": "17.2.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.2.1.tgz", + "integrity": "sha512-XfR8du6ua4K6uLGm5S6fA+FIJom/MdJcFNVY8geLlp2v8GYbOXD4EB1tPNZsRn4vBzKGMgb5DRZMeWuFc2GO8Q==", "dev": true, "dependencies": { "cliui": "^7.0.2", @@ -6287,7 +6314,7 @@ "yargs-parser": "^20.2.2" }, "engines": { - "node": ">=10" + "node": ">=12" } }, "node_modules/yargs-parser": { @@ -6362,35 +6389,35 @@ }, "dependencies": { "@babel/code-frame": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.15.8.tgz", - "integrity": "sha512-2IAnmn8zbvC/jKYhq5Ki9I+DwjlrtMPUCH/CpHvqI4dNnlwHwsxoIhlc8WcYY5LSYknXQtAlFYuHfqAFCvQ4Wg==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.0.tgz", + "integrity": "sha512-IF4EOMEV+bfYwOmNxGzSnjR2EmQod7f1UXOpZM3l4i4o4QNwzjtJAu/HxdjHq0aYBvdqMuQEY1eg0nqW9ZPORA==", "dev": true, "requires": { - "@babel/highlight": "^7.14.5" + "@babel/highlight": "^7.16.0" } }, "@babel/compat-data": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.15.0.tgz", - "integrity": "sha512-0NqAC1IJE0S0+lL1SWFMxMkz1pKCNCjI4tr2Zx4LJSXxCLAdr6KyArnY+sno5m3yH9g737ygOyPABDsnXkpxiA==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.16.0.tgz", + "integrity": "sha512-DGjt2QZse5SGd9nfOSqO4WLJ8NN/oHkijbXbPrxuoJO3oIPJL3TciZs9FX+cOHNiY9E9l0opL8g7BmLe3T+9ew==", "dev": true }, "@babel/core": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.15.8.tgz", - "integrity": "sha512-3UG9dsxvYBMYwRv+gS41WKHno4K60/9GPy1CJaH6xy3Elq8CTtvtjT5R5jmNhXfCYLX2mTw+7/aq5ak/gOE0og==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.0.tgz", + "integrity": "sha512-mYZEvshBRHGsIAiyH5PzCFTCfbWfoYbO/jcSdXQSUQu1/pW0xDZAUP7KEc32heqWTAfAHhV9j1vH8Sav7l+JNQ==", "dev": true, "requires": { - "@babel/code-frame": "^7.15.8", - "@babel/generator": "^7.15.8", - "@babel/helper-compilation-targets": "^7.15.4", - "@babel/helper-module-transforms": "^7.15.8", - "@babel/helpers": "^7.15.4", - "@babel/parser": "^7.15.8", - "@babel/template": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.6", + "@babel/code-frame": "^7.16.0", + "@babel/generator": "^7.16.0", + "@babel/helper-compilation-targets": "^7.16.0", + "@babel/helper-module-transforms": "^7.16.0", + "@babel/helpers": "^7.16.0", + "@babel/parser": "^7.16.0", + "@babel/template": "^7.16.0", + "@babel/traverse": "^7.16.0", + "@babel/types": "^7.16.0", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -6408,23 +6435,23 @@ } }, "@babel/generator": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.15.8.tgz", - "integrity": "sha512-ECmAKstXbp1cvpTTZciZCgfOt6iN64lR0d+euv3UZisU5awfRawOvg07Utn/qBGuH4bRIEZKrA/4LzZyXhZr8g==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.16.0.tgz", + "integrity": "sha512-RR8hUCfRQn9j9RPKEVXo9LiwoxLPYn6hNZlvUOR8tSnaxlD0p0+la00ZP9/SnRt6HchKr+X0fO2r8vrETiJGew==", "dev": true, "requires": { - "@babel/types": "^7.15.6", + "@babel/types": "^7.16.0", "jsesc": "^2.5.1", "source-map": "^0.5.0" } }, "@babel/helper-compilation-targets": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.15.4.tgz", - "integrity": "sha512-rMWPCirulnPSe4d+gwdWXLfAXTTBj8M3guAf5xFQJ0nvFY7tfNAFnWdqaHegHlgDZOCT4qvhF3BYlSJag8yhqQ==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.0.tgz", + "integrity": "sha512-S7iaOT1SYlqK0sQaCi21RX4+13hmdmnxIEAnQUB/eh7GeAnRjOUgTYpLkUOiRXzD+yog1JxP0qyAQZ7ZxVxLVg==", "dev": true, "requires": { - "@babel/compat-data": "^7.15.0", + "@babel/compat-data": "^7.16.0", "@babel/helper-validator-option": "^7.14.5", "browserslist": "^4.16.6", "semver": "^6.3.0" @@ -6439,105 +6466,105 @@ } }, "@babel/helper-function-name": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.15.4.tgz", - "integrity": "sha512-Z91cOMM4DseLIGOnog+Z8OI6YseR9bua+HpvLAQ2XayUGU+neTtX+97caALaLdyu53I/fjhbeCnWnRH1O3jFOw==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.0.tgz", + "integrity": "sha512-BZh4mEk1xi2h4HFjWUXRQX5AEx4rvaZxHgax9gcjdLWdkjsY7MKt5p0otjsg5noXw+pB+clMCjw+aEVYADMjog==", "dev": true, "requires": { - "@babel/helper-get-function-arity": "^7.15.4", - "@babel/template": "^7.15.4", - "@babel/types": "^7.15.4" + "@babel/helper-get-function-arity": "^7.16.0", + "@babel/template": "^7.16.0", + "@babel/types": "^7.16.0" } }, "@babel/helper-get-function-arity": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.15.4.tgz", - "integrity": "sha512-1/AlxSF92CmGZzHnC515hm4SirTxtpDnLEJ0UyEMgTMZN+6bxXKg04dKhiRx5Enel+SUA1G1t5Ed/yQia0efrA==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.0.tgz", + "integrity": "sha512-ASCquNcywC1NkYh/z7Cgp3w31YW8aojjYIlNg4VeJiHkqyP4AzIvr4qx7pYDb4/s8YcsZWqqOSxgkvjUz1kpDQ==", "dev": true, "requires": { - "@babel/types": "^7.15.4" + "@babel/types": "^7.16.0" } }, "@babel/helper-hoist-variables": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.15.4.tgz", - "integrity": "sha512-VTy085egb3jUGVK9ycIxQiPbquesq0HUQ+tPO0uv5mPEBZipk+5FkRKiWq5apuyTE9FUrjENB0rCf8y+n+UuhA==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.0.tgz", + "integrity": "sha512-1AZlpazjUR0EQZQv3sgRNfM9mEVWPK3M6vlalczA+EECcPz3XPh6VplbErL5UoMpChhSck5wAJHthlj1bYpcmg==", "dev": true, "requires": { - "@babel/types": "^7.15.4" + "@babel/types": "^7.16.0" } }, "@babel/helper-member-expression-to-functions": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.15.4.tgz", - "integrity": "sha512-cokOMkxC/BTyNP1AlY25HuBWM32iCEsLPI4BHDpJCHHm1FU2E7dKWWIXJgQgSFiu4lp8q3bL1BIKwqkSUviqtA==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.16.0.tgz", + "integrity": "sha512-bsjlBFPuWT6IWhl28EdrQ+gTvSvj5tqVP5Xeftp07SEuz5pLnsXZuDkDD3Rfcxy0IsHmbZ+7B2/9SHzxO0T+sQ==", "dev": true, "requires": { - "@babel/types": "^7.15.4" + "@babel/types": "^7.16.0" } }, "@babel/helper-module-imports": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.15.4.tgz", - "integrity": "sha512-jeAHZbzUwdW/xHgHQ3QmWR4Jg6j15q4w/gCfwZvtqOxoo5DKtLHk8Bsf4c5RZRC7NmLEs+ohkdq8jFefuvIxAA==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.0.tgz", + "integrity": "sha512-kkH7sWzKPq0xt3H1n+ghb4xEMP8k0U7XV3kkB+ZGy69kDk2ySFW1qPi06sjKzFY3t1j6XbJSqr4mF9L7CYVyhg==", "dev": true, "requires": { - "@babel/types": "^7.15.4" + "@babel/types": "^7.16.0" } }, "@babel/helper-module-transforms": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.15.8.tgz", - "integrity": "sha512-DfAfA6PfpG8t4S6npwzLvTUpp0sS7JrcuaMiy1Y5645laRJIp/LiLGIBbQKaXSInK8tiGNI7FL7L8UvB8gdUZg==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.0.tgz", + "integrity": "sha512-My4cr9ATcaBbmaEa8M0dZNA74cfI6gitvUAskgDtAFmAqyFKDSHQo5YstxPbN+lzHl2D9l/YOEFqb2mtUh4gfA==", "dev": true, "requires": { - "@babel/helper-module-imports": "^7.15.4", - "@babel/helper-replace-supers": "^7.15.4", - "@babel/helper-simple-access": "^7.15.4", - "@babel/helper-split-export-declaration": "^7.15.4", + "@babel/helper-module-imports": "^7.16.0", + "@babel/helper-replace-supers": "^7.16.0", + "@babel/helper-simple-access": "^7.16.0", + "@babel/helper-split-export-declaration": "^7.16.0", "@babel/helper-validator-identifier": "^7.15.7", - "@babel/template": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.6" + "@babel/template": "^7.16.0", + "@babel/traverse": "^7.16.0", + "@babel/types": "^7.16.0" } }, "@babel/helper-optimise-call-expression": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.15.4.tgz", - "integrity": "sha512-E/z9rfbAOt1vDW1DR7k4SzhzotVV5+qMciWV6LaG1g4jeFrkDlJedjtV4h0i4Q/ITnUu+Pk08M7fczsB9GXBDw==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.16.0.tgz", + "integrity": "sha512-SuI467Gi2V8fkofm2JPnZzB/SUuXoJA5zXe/xzyPP2M04686RzFKFHPK6HDVN6JvWBIEW8tt9hPR7fXdn2Lgpw==", "dev": true, "requires": { - "@babel/types": "^7.15.4" + "@babel/types": "^7.16.0" } }, "@babel/helper-replace-supers": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.15.4.tgz", - "integrity": "sha512-/ztT6khaXF37MS47fufrKvIsiQkx1LBRvSJNzRqmbyeZnTwU9qBxXYLaaT/6KaxfKhjs2Wy8kG8ZdsFUuWBjzw==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.16.0.tgz", + "integrity": "sha512-TQxuQfSCdoha7cpRNJvfaYxxxzmbxXw/+6cS7V02eeDYyhxderSoMVALvwupA54/pZcOTtVeJ0xccp1nGWladA==", "dev": true, "requires": { - "@babel/helper-member-expression-to-functions": "^7.15.4", - "@babel/helper-optimise-call-expression": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.4" + "@babel/helper-member-expression-to-functions": "^7.16.0", + "@babel/helper-optimise-call-expression": "^7.16.0", + "@babel/traverse": "^7.16.0", + "@babel/types": "^7.16.0" } }, "@babel/helper-simple-access": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.15.4.tgz", - "integrity": "sha512-UzazrDoIVOZZcTeHHEPYrr1MvTR/K+wgLg6MY6e1CJyaRhbibftF6fR2KU2sFRtI/nERUZR9fBd6aKgBlIBaPg==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.0.tgz", + "integrity": "sha512-o1rjBT/gppAqKsYfUdfHq5Rk03lMQrkPHG1OWzHWpLgVXRH4HnMM9Et9CVdIqwkCQlobnGHEJMsgWP/jE1zUiw==", "dev": true, "requires": { - "@babel/types": "^7.15.4" + "@babel/types": "^7.16.0" } }, "@babel/helper-split-export-declaration": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.15.4.tgz", - "integrity": "sha512-HsFqhLDZ08DxCpBdEVtKmywj6PQbwnF6HHybur0MAnkAKnlS6uHkwnmRIkElB2Owpfb4xL4NwDmDLFubueDXsw==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.0.tgz", + "integrity": "sha512-0YMMRpuDFNGTHNRiiqJX19GjNXA4H0E8jZ2ibccfSxaCogbm3am5WN/2nQNj0YnQwGWM1J06GOcQ2qnh3+0paw==", "dev": true, "requires": { - "@babel/types": "^7.15.4" + "@babel/types": "^7.16.0" } }, "@babel/helper-validator-identifier": { @@ -6553,23 +6580,23 @@ "dev": true }, "@babel/helpers": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.15.4.tgz", - "integrity": "sha512-V45u6dqEJ3w2rlryYYXf6i9rQ5YMNu4FLS6ngs8ikblhu2VdR1AqAd6aJjBzmf2Qzh6KOLqKHxEN9+TFbAkAVQ==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.16.0.tgz", + "integrity": "sha512-dVRM0StFMdKlkt7cVcGgwD8UMaBfWJHl3A83Yfs8GQ3MO0LHIIIMvK7Fa0RGOGUQ10qikLaX6D7o5htcQWgTMQ==", "dev": true, "requires": { - "@babel/template": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.4" + "@babel/template": "^7.16.0", + "@babel/traverse": "^7.16.0", + "@babel/types": "^7.16.0" } }, "@babel/highlight": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.5.tgz", - "integrity": "sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.0.tgz", + "integrity": "sha512-t8MH41kUQylBtu2+4IQA3atqevA2lRgqA2wyVB/YiWmsDSuylZZuXOUy9ric30hfzauEFfdsuk/eXTRrGrfd0g==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.14.5", + "@babel/helper-validator-identifier": "^7.15.7", "chalk": "^2.0.0", "js-tokens": "^4.0.0" }, @@ -6633,35 +6660,35 @@ } }, "@babel/parser": { - "version": "7.15.8", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.15.8.tgz", - "integrity": "sha512-BRYa3wcQnjS/nqI8Ac94pYYpJfojHVvVXJ97+IDCImX4Jc8W8Xv1+47enbruk+q1etOpsQNwnfFcNGw+gtPGxA==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.0.tgz", + "integrity": "sha512-TEHWXf0xxpi9wKVyBCmRcSSDjbJ/cl6LUdlbYUHEaNQUJGhreJbZrXT6sR4+fZLxVUJqNRB4KyOvjuy/D9009A==", "dev": true }, "@babel/template": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.15.4.tgz", - "integrity": "sha512-UgBAfEa1oGuYgDIPM2G+aHa4Nlo9Lh6mGD2bDBGMTbYnc38vulXPuC1MGjYILIEmlwl6Rd+BPR9ee3gm20CBtg==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.0.tgz", + "integrity": "sha512-MnZdpFD/ZdYhXwiunMqqgyZyucaYsbL0IrjoGjaVhGilz+x8YB++kRfygSOIj1yOtWKPlx7NBp+9I1RQSgsd5A==", "dev": true, "requires": { - "@babel/code-frame": "^7.14.5", - "@babel/parser": "^7.15.4", - "@babel/types": "^7.15.4" + "@babel/code-frame": "^7.16.0", + "@babel/parser": "^7.16.0", + "@babel/types": "^7.16.0" } }, "@babel/traverse": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.15.4.tgz", - "integrity": "sha512-W6lQD8l4rUbQR/vYgSuCAE75ADyyQvOpFVsvPPdkhf6lATXAsQIG9YdtOcu8BB1dZ0LKu+Zo3c1wEcbKeuhdlA==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.0.tgz", + "integrity": "sha512-qQ84jIs1aRQxaGaxSysII9TuDaguZ5yVrEuC0BN2vcPlalwfLovVmCjbFDPECPXcYM/wLvNFfp8uDOliLxIoUQ==", "dev": true, "requires": { - "@babel/code-frame": "^7.14.5", - "@babel/generator": "^7.15.4", - "@babel/helper-function-name": "^7.15.4", - "@babel/helper-hoist-variables": "^7.15.4", - "@babel/helper-split-export-declaration": "^7.15.4", - "@babel/parser": "^7.15.4", - "@babel/types": "^7.15.4", + "@babel/code-frame": "^7.16.0", + "@babel/generator": "^7.16.0", + "@babel/helper-function-name": "^7.16.0", + "@babel/helper-hoist-variables": "^7.16.0", + "@babel/helper-split-export-declaration": "^7.16.0", + "@babel/parser": "^7.16.0", + "@babel/types": "^7.16.0", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -6675,12 +6702,12 @@ } }, "@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.16.0.tgz", + "integrity": "sha512-PJgg/k3SdLsGb3hhisFvtLOw5ts113klrpLuIPtCJIU+BB24fqq6lf8RWqKJEjzqXR9AEH1rIb5XTqwBHB+kQg==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.14.9", + "@babel/helper-validator-identifier": "^7.15.7", "to-fast-properties": "^2.0.0" } }, @@ -7122,9 +7149,9 @@ "dev": true }, "@types/node": { - "version": "16.11.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.1.tgz", - "integrity": "sha512-PYGcJHL9mwl1Ek3PLiYgyEKtwTMmkMw4vbiyz/ps3pfdRYLVv+SN7qHVAImrjdAXxgluDEw6Ph4lyv+m9UpRmA==", + "version": "16.11.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.6.tgz", + "integrity": "sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==", "dev": true }, "@types/parse-json": { @@ -7143,34 +7170,43 @@ } }, "@types/sinon": { - "version": "10.0.4", - "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.4.tgz", - "integrity": "sha512-fOYjrxQv8zJsqOY6V6ecP4eZhQBxtY80X0er1VVnUIAIZo74jHm8e1vguG5Yt4Iv8W2Wr7TgibB8MfRe32k9pA==", + "version": "10.0.6", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.6.tgz", + "integrity": "sha512-6EF+wzMWvBNeGrfP3Nx60hhx+FfwSg1JJBLAAP/IdIUq0EYkqCYf70VT3PhuhPX9eLD+Dp+lNdpb/ZeHG8Yezg==", "dev": true, "requires": { "@sinonjs/fake-timers": "^7.1.0" } }, - "@types/which": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@types/which/-/which-2.0.1.tgz", - "integrity": "sha512-Jjakcv8Roqtio6w1gr0D7y6twbhx6gGgFGF5BLwajPpnOIOxFkakFhCq+LmyyeAz7BX6ULrjBOxdKaCDy+4+dQ==", - "dev": true - }, "@types/yallist": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@types/yallist/-/yallist-4.0.1.tgz", "integrity": "sha512-G3FNJfaYtN8URU6wd6+uwFI62KO79j7n3XTYcwcFncP8gkfoi0b821GoVVt0oqKVnCqKYOMNKIGpakPoFhzAGA==", "dev": true }, - "@typescript-eslint/eslint-plugin": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.1.0.tgz", - "integrity": "sha512-bekODL3Tqf36Yz8u+ilha4zGxL9mdB6LIsIoMAvvC5FAuWo4NpZYXtCbv7B2CeR1LhI/lLtLk+q4tbtxuoVuCg==", + "@types/yargs": { + "version": "17.0.5", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.5.tgz", + "integrity": "sha512-4HNq144yhaVjJs+ON6A07NEoi9Hh0Rhl/jI9Nt/l/YRjt+T6St/QK3meFARWZ8IgkzoD1LC0PdTdJenlQQi2WQ==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "5.1.0", - "@typescript-eslint/scope-manager": "5.1.0", + "@types/yargs-parser": "*" + } + }, + "@types/yargs-parser": { + "version": "20.2.1", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-20.2.1.tgz", + "integrity": "sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw==", + "dev": true + }, + "@typescript-eslint/eslint-plugin": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.2.0.tgz", + "integrity": "sha512-qQwg7sqYkBF4CIQSyRQyqsYvP+g/J0To9ZPVNJpfxfekl5RmdvQnFFTVVwpRtaUDFNvjfe/34TgY/dpc3MgNTw==", + "dev": true, + "requires": { + "@typescript-eslint/experimental-utils": "5.2.0", + "@typescript-eslint/scope-manager": "5.2.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -7180,55 +7216,55 @@ } }, "@typescript-eslint/experimental-utils": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.1.0.tgz", - "integrity": "sha512-ovE9qUiZMOMgxQAESZsdBT+EXIfx/YUYAbwGUI6V03amFdOOxI9c6kitkgRvLkJaLusgMZ2xBhss+tQ0Y1HWxA==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.2.0.tgz", + "integrity": "sha512-fWyT3Agf7n7HuZZRpvUYdFYbPk3iDCq6fgu3ulia4c7yxmPnwVBovdSOX7RL+k8u6hLbrXcdAehlWUVpGh6IEw==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.1.0", - "@typescript-eslint/types": "5.1.0", - "@typescript-eslint/typescript-estree": "5.1.0", + "@typescript-eslint/scope-manager": "5.2.0", + "@typescript-eslint/types": "5.2.0", + "@typescript-eslint/typescript-estree": "5.2.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" } }, "@typescript-eslint/parser": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.1.0.tgz", - "integrity": "sha512-vx1P+mhCtYw3+bRHmbalq/VKP2Y3gnzNgxGxfEWc6OFpuEL7iQdAeq11Ke3Rhy8NjgB+AHsIWEwni3e+Y7djKA==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.2.0.tgz", + "integrity": "sha512-Uyy4TjJBlh3NuA8/4yIQptyJb95Qz5PX//6p8n7zG0QnN4o3NF9Je3JHbVU7fxf5ncSXTmnvMtd/LDQWDk0YqA==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.1.0", - "@typescript-eslint/types": "5.1.0", - "@typescript-eslint/typescript-estree": "5.1.0", + "@typescript-eslint/scope-manager": "5.2.0", + "@typescript-eslint/types": "5.2.0", + "@typescript-eslint/typescript-estree": "5.2.0", "debug": "^4.3.2" } }, "@typescript-eslint/scope-manager": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.1.0.tgz", - "integrity": "sha512-yYlyVjvn5lvwCL37i4hPsa1s0ORsjkauhTqbb8MnpvUs7xykmcjGqwlNZ2Q5QpoqkJ1odlM2bqHqJwa28qV6Tw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.2.0.tgz", + "integrity": "sha512-RW+wowZqPzQw8MUFltfKYZfKXqA2qgyi6oi/31J1zfXJRpOn6tCaZtd9b5u9ubnDG2n/EMvQLeZrsLNPpaUiFQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.1.0", - "@typescript-eslint/visitor-keys": "5.1.0" + "@typescript-eslint/types": "5.2.0", + "@typescript-eslint/visitor-keys": "5.2.0" } }, "@typescript-eslint/types": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.1.0.tgz", - "integrity": "sha512-sEwNINVxcB4ZgC6Fe6rUyMlvsB2jvVdgxjZEjQUQVlaSPMNamDOwO6/TB98kFt4sYYfNhdhTPBEQqNQZjMMswA==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.2.0.tgz", + "integrity": "sha512-cTk6x08qqosps6sPyP2j7NxyFPlCNsJwSDasqPNjEQ8JMD5xxj2NHxcLin5AJQ8pAVwpQ8BMI3bTxR0zxmK9qQ==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.1.0.tgz", - "integrity": "sha512-SSz+l9YrIIsW4s0ZqaEfnjl156XQ4VRmJsbA0ZE1XkXrD3cRpzuZSVCyqeCMR3EBjF27IisWakbBDGhGNIOvfQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.2.0.tgz", + "integrity": "sha512-RsdXq2XmVgKbm9nLsE3mjNUM7BTr/K4DYR9WfFVMUuozHWtH5gMpiNZmtrMG8GR385EOSQ3kC9HiEMJWimxd/g==", "dev": true, "requires": { - "@typescript-eslint/types": "5.1.0", - "@typescript-eslint/visitor-keys": "5.1.0", + "@typescript-eslint/types": "5.2.0", + "@typescript-eslint/visitor-keys": "5.2.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -7237,12 +7273,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.1.0.tgz", - "integrity": "sha512-uqNXepKBg81JVwjuqAxYrXa1Ql/YDzM+8g/pS+TCPxba0wZttl8m5DkrasbfnmJGHs4lQ2jTbcZ5azGhI7kK+w==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.2.0.tgz", + "integrity": "sha512-Nk7HizaXWWCUBfLA/rPNKMzXzWS8Wg9qHMuGtT+v2/YpPij4nVXrVJc24N/r5WrrmqK31jCrZxeHqIgqRzs0Xg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.1.0", + "@typescript-eslint/types": "5.2.0", "eslint-visitor-keys": "^3.0.0" } }, @@ -7483,15 +7519,15 @@ "dev": true }, "browserslist": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.4.tgz", - "integrity": "sha512-Zg7RpbZpIJRW3am9Lyckue7PLytvVxxhJj1CaJVlCWENsGEAOlnlt8X0ZxGRPp7Bt9o8tIRM5SEXy4BCPMJjLQ==", + "version": "4.17.5", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.5.tgz", + "integrity": "sha512-I3ekeB92mmpctWBoLXe0d5wPS2cBuRvvW0JyyJHMrk9/HmP2ZjrTboNAZ8iuGqaEIlKguljbQY32OkOJIRrgoA==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30001265", - "electron-to-chromium": "^1.3.867", + "caniuse-lite": "^1.0.30001271", + "electron-to-chromium": "^1.3.878", "escalade": "^3.1.1", - "node-releases": "^2.0.0", + "node-releases": "^2.0.1", "picocolors": "^1.0.0" } }, @@ -7578,9 +7614,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001269", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001269.tgz", - "integrity": "sha512-UOy8okEVs48MyHYgV+RdW1Oiudl1H6KolybD6ZquD0VcrPSgj25omXO1S7rDydjpqaISCwA8Pyx+jUQKZwWO5w==", + "version": "1.0.30001274", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001274.tgz", + "integrity": "sha512-+Nkvv0fHyhISkiMIjnyjmf5YJcQ1IQHZN6U9TLUMroWR38FNwpsC51Gb68yueafX1V6ifOisInSgP9WJFS13ew==", "dev": true }, "chalk": { @@ -7927,9 +7963,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.3.872", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.872.tgz", - "integrity": "sha512-qG96atLFY0agKyEETiBFNhpRLSXGSXOBuhXWpbkYqrLKKASpRyRBUtfkn0ZjIf/yXfA7FA4nScVOMpXSHFlUCQ==", + "version": "1.3.885", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.885.tgz", + "integrity": "sha512-JXKFJcVWrdHa09n4CNZYfYaK6EW5aAew7/wr3L1OnsD1L+JHL+RCtd7QgIsxUbFPeTwPlvnpqNNTOLkoefmtXg==", "dev": true }, "emoji-regex": { @@ -7990,9 +8026,9 @@ "dev": true }, "eslint": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.0.1.tgz", - "integrity": "sha512-LsgcwZgQ72vZ+SMp4K6pAnk2yFDWL7Ti4pJaRvsZ0Hsw2h8ZjUIW38a9AFn2cZXdBMlScMFYYgsSp4ttFI/0bA==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.1.0.tgz", + "integrity": "sha512-JZvNneArGSUsluHWJ8g8MMs3CfIEzwaLx9KyH4tZ2i+R2/rPWzL8c0zg3rHdwYVpN/1sB9gqnjHwz9HoeJpGHw==", "dev": true, "requires": { "@eslint/eslintrc": "^1.0.3", @@ -8046,9 +8082,9 @@ } }, "estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true }, "ignore": { @@ -8119,9 +8155,9 @@ }, "dependencies": { "estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true } } @@ -8136,9 +8172,9 @@ }, "dependencies": { "estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true } } @@ -8462,9 +8498,9 @@ } }, "globals": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.11.0.tgz", - "integrity": "sha512-08/xrJ7wQjK9kkkRoI3OFUBbLx4f+6x3SGwcPvQ0QH6goFDrOU2oyAWrmh3dJezu65buo+HBMzAMQy6rovVC3g==", + "version": "13.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz", + "integrity": "sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg==", "dev": true, "requires": { "type-fest": "^0.20.2" @@ -9069,9 +9105,9 @@ "dev": true }, "keyv": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.0.3.tgz", - "integrity": "sha512-zdGa2TOpSZPq5mU6iowDARnMBZgtCqJ11dJROFi6tg6kTn4nuUdU09lFyLFSaHrWqpIJ+EBq4E8/Dc0Vx5vLdA==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.0.4.tgz", + "integrity": "sha512-vqNHbAc8BBsxk+7QBYLW0Y219rWcClspR6WSeoHYKG5mnsSoOH+BL1pWq02DDCVdvvuUny5rkBlzMRzoqc+GIg==", "dev": true, "requires": { "json-buffer": "3.0.1" @@ -9196,9 +9232,9 @@ "dev": true }, "marked": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/marked/-/marked-3.0.7.tgz", - "integrity": "sha512-ctKqbnLuNbsHbI26cfMyOlKgXGfl1orOv1AvWWDX7AkgfMOwCWvmuYc+mVLeWhQ9W6hdWVBynOs96VkcscKo0Q==", + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/marked/-/marked-3.0.8.tgz", + "integrity": "sha512-0gVrAjo5m0VZSJb4rpL59K1unJAMb/hm8HRXqasD8VeC8m91ytDPMritgFSlKonfdt+rRYYpP/JfLxgIX8yoSw==", "dev": true }, "merge-stream": { @@ -9311,6 +9347,21 @@ "requires": { "has-flag": "^4.0.0" } + }, + "yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + } } } }, @@ -9375,9 +9426,9 @@ } }, "node-fetch": { - "version": "2.6.5", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz", - "integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==", + "version": "2.6.6", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz", + "integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==", "dev": true, "requires": { "whatwg-url": "^5.0.0" @@ -9393,9 +9444,9 @@ } }, "node-releases": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.0.tgz", - "integrity": "sha512-aA87l0flFYMzCHpTM3DERFSYxc6lv/BltdbRTOMZuxZ0cwZCD3mejE5n9vLhSJCN++/eOqr77G1IO5uXxlQYWA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz", + "integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==", "dev": true }, "normalize-path": { @@ -10671,9 +10722,9 @@ "dev": true }, "ts-node": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.3.0.tgz", - "integrity": "sha512-RYIy3i8IgpFH45AX4fQHExrT8BxDeKTdC83QFJkNzkvt8uFB6QJ8XMyhynYiKMLxt9a7yuXaDBZNOYS3XjDcYw==", + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.4.0.tgz", + "integrity": "sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==", "dev": true, "requires": { "@cspotcode/source-map-support": "0.7.0", @@ -10752,16 +10803,16 @@ } }, "typedoc": { - "version": "0.22.6", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.22.6.tgz", - "integrity": "sha512-ePbJqOaz0GNkU2ehRwFwBpLD4Gp6m7jbJfHysXmDdjVKc1g8DFJ83r/LOZ9TZrkC661vgpoIY3FjSPEtUilHNA==", + "version": "0.22.7", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.22.7.tgz", + "integrity": "sha512-ndxxp+tU1Wczvdxp4u2/PvT1qjD6hdFdSdehpORHjE+JXmMkl2bftXCR0upHmsnesBG7VCcr8vfgloGHIH8glQ==", "dev": true, "requires": { "glob": "^7.2.0", "lunr": "^2.3.9", - "marked": "^3.0.4", + "marked": "^3.0.8", "minimatch": "^3.0.4", - "shiki": "^0.9.11" + "shiki": "^0.9.12" }, "dependencies": { "glob": { @@ -11074,9 +11125,9 @@ "dev": true }, "yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "version": "17.2.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.2.1.tgz", + "integrity": "sha512-XfR8du6ua4K6uLGm5S6fA+FIJom/MdJcFNVY8geLlp2v8GYbOXD4EB1tPNZsRn4vBzKGMgb5DRZMeWuFc2GO8Q==", "dev": true, "requires": { "cliui": "^7.0.2", diff --git a/package.json b/package.json index beddb1f86d..f252e4a0fa 100644 --- a/package.json +++ b/package.json @@ -27,24 +27,24 @@ "@istanbuljs/nyc-config-typescript": "^1.0.1", "@tsconfig/node12": "^1.0.9", "@types/mocha": "^9.0.0", - "@types/node": "^16.11.1", - "@types/sinon": "^10.0.4", - "@types/which": "^2.0.1", + "@types/node": "^16.11.6", + "@types/sinon": "^10.0.6", "@types/yallist": "^4.0.1", - "@typescript-eslint/eslint-plugin": "^5.1.0", - "@typescript-eslint/parser": "^5.1.0", - "eslint": "^8.0.1", + "@types/yargs": "^17.0.5", + "@typescript-eslint/eslint-plugin": "^5.2.0", + "@typescript-eslint/parser": "^5.2.0", + "eslint": "^8.1.0", "mocha": "^9.1.3", "nyc": "^15.1.0", "release-it": "^14.11.6", "sinon": "^11.1.2", "source-map-support": "^0.5.20", - "ts-node": "^10.3.0", - "typedoc": "^0.22.6", + "ts-node": "^10.4.0", + "typedoc": "^0.22.7", "typedoc-github-wiki-theme": "^0.6.0", "typedoc-plugin-markdown": "^3.11.3", "typescript": "^4.4.4", - "which": "^2.0.2" + "yargs": "^17.2.1" }, "engines": { "node": ">=12"