diff --git a/test/auth.spec.js b/test/auth.spec.js index 61e185fc85..f09cef6f98 100644 --- a/test/auth.spec.js +++ b/test/auth.spec.js @@ -37,7 +37,7 @@ describe("client authentication", function () { it("allows auth to be provided with 'auth' method", function (done) { if (helper.redisProcess().spawnFailed()) this.skip(); - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.auth(auth, function (err, res) { assert.strictEqual(null, err); assert.strictEqual("OK", res.toString()); @@ -48,7 +48,7 @@ describe("client authentication", function () { it("emits error when auth is bad without callback", function (done) { if (helper.redisProcess().spawnFailed()) this.skip(); - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once('error', function (err) { assert.strictEqual(err.command, 'AUTH'); @@ -62,7 +62,7 @@ describe("client authentication", function () { it("returns an error when auth is bad (empty string) with a callback", function (done) { if (helper.redisProcess().spawnFailed()) this.skip(); - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.auth('', function (err, res) { assert.strictEqual(err.command, 'AUTH'); @@ -114,7 +114,7 @@ describe("client authentication", function () { var args = config.configureClient(parser, ip, { auth_pass: auth }); - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.on("ready", function () { return done(); }); @@ -127,7 +127,7 @@ describe("client authentication", function () { password: auth, no_ready_check: true }); - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.on("ready", function () { done(); }); @@ -137,7 +137,7 @@ describe("client authentication", function () { if (helper.redisProcess().spawnFailed()) this.skip(); var args = config.configureClient(parser, ip); - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.auth(auth); client.on("ready", function () { return done(); @@ -148,7 +148,7 @@ describe("client authentication", function () { if (helper.redisProcess().spawnFailed()) this.skip(); var readyCount = 0; - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.auth(auth); client.on("ready", function () { readyCount++; @@ -163,7 +163,7 @@ describe("client authentication", function () { it('should return an error if the password is not of type string and a callback has been provided', function (done) { if (helper.redisProcess().spawnFailed()) this.skip(); - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); var async = true; client.auth(undefined, function(err, res) { assert.strictEqual(err.message, 'ERR invalid password'); @@ -178,7 +178,7 @@ describe("client authentication", function () { it('should emit an error if the password is not of type string and no callback has been provided', function (done) { if (helper.redisProcess().spawnFailed()) this.skip(); - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.on('error', function (err) { assert.strictEqual(err.message, 'ERR invalid password'); assert.strictEqual(err.command, 'AUTH'); @@ -193,7 +193,7 @@ describe("client authentication", function () { var args = config.configureClient(parser, ip, { auth_pass: auth }); - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.on("ready", function () { client.auth(auth, helper.isString('OK', done)); }); @@ -205,7 +205,7 @@ describe("client authentication", function () { var args = config.configureClient(parser, ip, { no_ready_check: true }); - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.on("ready", function () { client.set('foo', 'bar', function (err, res) { assert.equal(err.message, 'NOAUTH Authentication required.'); @@ -218,7 +218,7 @@ describe("client authentication", function () { it('does not allow auth to be provided post-hoc with auth method if not authenticated before', function (done) { if (helper.redisProcess().spawnFailed()) this.skip(); - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.on("error", function (err) { assert.equal(err.code, 'NOAUTH'); assert.equal(err.message, 'Ready check failed: NOAUTH Authentication required.'); diff --git a/test/batch.spec.js b/test/batch.spec.js index ba4c9020bb..5a1ace4e7d 100644 --- a/test/batch.spec.js +++ b/test/batch.spec.js @@ -22,13 +22,11 @@ describe("The 'batch' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("connect", function () { client.quit(); }); - client.on('end', function () { - return done(); - }); + client.on('end', done); }); it("returns an empty array", function (done) { @@ -51,7 +49,7 @@ describe("The 'batch' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(function (err) { return done(err); diff --git a/test/commands/blpop.spec.js b/test/commands/blpop.spec.js index 4105dcd9c5..bf081233b8 100644 --- a/test/commands/blpop.spec.js +++ b/test/commands/blpop.spec.js @@ -15,14 +15,14 @@ describe("The 'blpop' method", function () { var bclient; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); }); it('pops value immediately if list contains values', function (done) { - bclient = redis.createClient.apply(redis.createClient, args); + bclient = redis.createClient.apply(null, args); redis.debug_mode = true; var text = ''; var unhookIntercept = intercept(function(data) { @@ -41,7 +41,7 @@ describe("The 'blpop' method", function () { }); it('pops value immediately if list contains values using array notation', function (done) { - bclient = redis.createClient.apply(redis.createClient, args); + bclient = redis.createClient.apply(null, args); client.rpush(["blocking list", "initial value"], helper.isNumber(1)); bclient.blpop(["blocking list", 0], function (err, value) { assert.strictEqual(value[0], "blocking list"); @@ -51,7 +51,7 @@ describe("The 'blpop' method", function () { }); it('waits for value if list is not yet populated', function (done) { - bclient = redis.createClient.apply(redis.createClient, args); + bclient = redis.createClient.apply(null, args); bclient.blpop("blocking list 2", 5, function (err, value) { assert.strictEqual(value[0], "blocking list 2"); assert.strictEqual(value[1], "initial value"); @@ -61,7 +61,7 @@ describe("The 'blpop' method", function () { }); it('times out after specified time', function (done) { - bclient = redis.createClient.apply(redis.createClient, args); + bclient = redis.createClient.apply(null, args); bclient.BLPOP("blocking list", 1, function (err, res) { assert.strictEqual(res, null); return done(err); diff --git a/test/commands/client.spec.js b/test/commands/client.spec.js index f0f1f205ad..661f70d0be 100644 --- a/test/commands/client.spec.js +++ b/test/commands/client.spec.js @@ -14,7 +14,7 @@ describe("The 'client' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/dbsize.spec.js b/test/commands/dbsize.spec.js index aa1fb57fcf..0bc922c2f3 100644 --- a/test/commands/dbsize.spec.js +++ b/test/commands/dbsize.spec.js @@ -22,13 +22,11 @@ describe("The 'dbsize' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.quit(); }); - client.on('end', function () { - return done(); - }); + client.on('end', done); }); it("reports an error", function (done) { @@ -43,7 +41,7 @@ describe("The 'dbsize' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(function (err, res) { helper.isString("OK")(err, res); diff --git a/test/commands/del.spec.js b/test/commands/del.spec.js index d5dc8fbb64..99f3e8fcae 100644 --- a/test/commands/del.spec.js +++ b/test/commands/del.spec.js @@ -12,7 +12,7 @@ describe("The 'del' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/eval.spec.js b/test/commands/eval.spec.js index d091a4dbd7..2fdd7857d5 100644 --- a/test/commands/eval.spec.js +++ b/test/commands/eval.spec.js @@ -15,7 +15,7 @@ describe("The 'eval' method", function () { var source = "return redis.call('set', 'sha', 'test')"; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/exists.spec.js b/test/commands/exists.spec.js index 080e1d1e65..7135c10553 100644 --- a/test/commands/exists.spec.js +++ b/test/commands/exists.spec.js @@ -12,7 +12,7 @@ describe("The 'exists' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/expire.spec.js b/test/commands/expire.spec.js index 99da8e007b..679b152f5a 100644 --- a/test/commands/expire.spec.js +++ b/test/commands/expire.spec.js @@ -12,7 +12,7 @@ describe("The 'expire' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/flushdb.spec.js b/test/commands/flushdb.spec.js index e1c073c0f2..97e46e36e1 100644 --- a/test/commands/flushdb.spec.js +++ b/test/commands/flushdb.spec.js @@ -22,13 +22,11 @@ describe("The 'flushdb' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.quit(); }); - client.on('end', function () { - return done(); - }); + client.on('end', done); }); it("reports an error", function (done) { @@ -43,7 +41,7 @@ describe("The 'flushdb' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { done(); }); diff --git a/test/commands/geoadd.spec.js b/test/commands/geoadd.spec.js index 70ba278a6b..026d0fe717 100644 --- a/test/commands/geoadd.spec.js +++ b/test/commands/geoadd.spec.js @@ -12,7 +12,7 @@ describe("The 'geoadd' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/get.spec.js b/test/commands/get.spec.js index 7f1f0cdf4c..cc4a7386a1 100644 --- a/test/commands/get.spec.js +++ b/test/commands/get.spec.js @@ -22,13 +22,11 @@ describe("The 'get' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.quit(); }); - client.on('end', function () { - return done(); - }); + client.on('end', done); }); it("reports an error", function (done) { @@ -49,7 +47,7 @@ describe("The 'get' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { done(); }); diff --git a/test/commands/getset.spec.js b/test/commands/getset.spec.js index b39b028413..0ebbb12f15 100644 --- a/test/commands/getset.spec.js +++ b/test/commands/getset.spec.js @@ -23,13 +23,11 @@ describe("The 'getset' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.quit(); }); - client.on('end', function () { - return done(); - }); + client.on('end', done); }); it("reports an error", function (done) { @@ -44,7 +42,7 @@ describe("The 'getset' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { done(); }); diff --git a/test/commands/hgetall.spec.js b/test/commands/hgetall.spec.js index d531703eeb..0195ba5f65 100644 --- a/test/commands/hgetall.spec.js +++ b/test/commands/hgetall.spec.js @@ -15,7 +15,7 @@ describe("The 'hgetall' method", function () { describe('regular client', function () { beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); @@ -56,7 +56,7 @@ describe("The 'hgetall' method", function () { }); beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/hincrby.spec.js b/test/commands/hincrby.spec.js index d2d03c9546..5e933d23ce 100644 --- a/test/commands/hincrby.spec.js +++ b/test/commands/hincrby.spec.js @@ -13,7 +13,7 @@ describe("The 'hincrby' method", function () { var hash = "test hash"; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/hlen.spec.js b/test/commands/hlen.spec.js index e366582b91..b8fa3e99c6 100644 --- a/test/commands/hlen.spec.js +++ b/test/commands/hlen.spec.js @@ -12,7 +12,7 @@ describe("The 'hlen' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/hmget.spec.js b/test/commands/hmget.spec.js index 4e90dd40a0..996ed25570 100644 --- a/test/commands/hmget.spec.js +++ b/test/commands/hmget.spec.js @@ -14,7 +14,7 @@ describe("The 'hmget' method", function () { var hash = 'test hash'; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("error", done); client.once("ready", function () { client.flushdb(); diff --git a/test/commands/hmset.spec.js b/test/commands/hmset.spec.js index 2dbc62e7fc..e6f9931236 100644 --- a/test/commands/hmset.spec.js +++ b/test/commands/hmset.spec.js @@ -14,7 +14,7 @@ describe("The 'hmset' method", function () { var hash = 'test hash'; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/hset.spec.js b/test/commands/hset.spec.js index 2d0932476a..bd5415189c 100644 --- a/test/commands/hset.spec.js +++ b/test/commands/hset.spec.js @@ -14,7 +14,7 @@ describe("The 'hset' method", function () { var hash = 'test hash'; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/incr.spec.js b/test/commands/incr.spec.js index 1910bd2943..b0d605ae22 100644 --- a/test/commands/incr.spec.js +++ b/test/commands/incr.spec.js @@ -16,16 +16,14 @@ describe("The 'incr' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.set(key, "9007199254740992", function (err, res) { helper.isNotError()(err, res); client.quit(); }); }); - client.on('end', function () { - return done(); - }); + client.on('end', done); }); afterEach(function () { @@ -52,7 +50,7 @@ describe("The 'incr' method", function () { 9007199254740996 -> 9007199254740996 9007199254740997 -> 9007199254740996 */ - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("error", done); client.once("ready", function () { client.set(key, "9007199254740992", function (err, res) { diff --git a/test/commands/info.spec.js b/test/commands/info.spec.js index 9ce968051f..64daf7acdf 100644 --- a/test/commands/info.spec.js +++ b/test/commands/info.spec.js @@ -13,7 +13,7 @@ describe("The 'info' method", function () { var client; before(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushall(done); }); diff --git a/test/commands/keys.spec.js b/test/commands/keys.spec.js index 5522c2dfaa..7af3ae40c9 100644 --- a/test/commands/keys.spec.js +++ b/test/commands/keys.spec.js @@ -14,7 +14,7 @@ describe("The 'keys' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushall(done); }); diff --git a/test/commands/mget.spec.js b/test/commands/mget.spec.js index 0907558e56..8e395dedbe 100644 --- a/test/commands/mget.spec.js +++ b/test/commands/mget.spec.js @@ -13,7 +13,7 @@ describe("The 'mget' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("error", done); client.once("ready", function () { client.flushdb(); diff --git a/test/commands/mset.spec.js b/test/commands/mset.spec.js index c5d754fc6f..81ab6d3bc6 100644 --- a/test/commands/mset.spec.js +++ b/test/commands/mset.spec.js @@ -24,13 +24,11 @@ describe("The 'mset' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.quit(); }); - client.on('end', function () { - return done(); - }); + client.on('end', done); }); it("reports an error", function (done) { @@ -45,7 +43,7 @@ describe("The 'mset' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { done(); }); diff --git a/test/commands/msetnx.spec.js b/test/commands/msetnx.spec.js index e3f1d3afaa..59cd62187c 100644 --- a/test/commands/msetnx.spec.js +++ b/test/commands/msetnx.spec.js @@ -12,7 +12,7 @@ describe("The 'msetnx' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/randomkey.test.js b/test/commands/randomkey.test.js index 72fd2fda88..671942effe 100644 --- a/test/commands/randomkey.test.js +++ b/test/commands/randomkey.test.js @@ -13,7 +13,7 @@ describe("The 'randomkey' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/rename.spec.js b/test/commands/rename.spec.js index dc1de1e3af..e6d8b938a1 100644 --- a/test/commands/rename.spec.js +++ b/test/commands/rename.spec.js @@ -12,7 +12,7 @@ describe("The 'rename' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/renamenx.spec.js b/test/commands/renamenx.spec.js index bd4e823235..ef503c96fb 100644 --- a/test/commands/renamenx.spec.js +++ b/test/commands/renamenx.spec.js @@ -12,7 +12,7 @@ describe("The 'renamenx' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/rpush.spec.js b/test/commands/rpush.spec.js index b6c1562b80..59d776cbcc 100644 --- a/test/commands/rpush.spec.js +++ b/test/commands/rpush.spec.js @@ -13,7 +13,7 @@ describe("The 'rpush' command", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/sadd.spec.js b/test/commands/sadd.spec.js index 504dc47541..6333d940ff 100644 --- a/test/commands/sadd.spec.js +++ b/test/commands/sadd.spec.js @@ -13,7 +13,7 @@ describe("The 'sadd' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/scard.spec.js b/test/commands/scard.spec.js index 8c8eb70d1f..162513b4ed 100644 --- a/test/commands/scard.spec.js +++ b/test/commands/scard.spec.js @@ -12,7 +12,7 @@ describe("The 'scard' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/script.spec.js b/test/commands/script.spec.js index e7eecc172b..e69f25025e 100644 --- a/test/commands/script.spec.js +++ b/test/commands/script.spec.js @@ -16,7 +16,7 @@ describe("The 'script' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/sdiff.spec.js b/test/commands/sdiff.spec.js index 7121b1e95f..4a9e8c651b 100644 --- a/test/commands/sdiff.spec.js +++ b/test/commands/sdiff.spec.js @@ -13,7 +13,7 @@ describe("The 'sdiff' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/sdiffstore.spec.js b/test/commands/sdiffstore.spec.js index 1963317a70..eb8fb79952 100644 --- a/test/commands/sdiffstore.spec.js +++ b/test/commands/sdiffstore.spec.js @@ -13,7 +13,7 @@ describe("The 'sdiffstore' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/select.spec.js b/test/commands/select.spec.js index b3ef6d5893..2d0ac3a104 100644 --- a/test/commands/select.spec.js +++ b/test/commands/select.spec.js @@ -14,13 +14,11 @@ describe("The 'select' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.quit(); }); - client.on('end', function () { - return done(); - }); + client.on('end', done); }); it("returns an error if redis is not connected", function (done) { @@ -36,7 +34,7 @@ describe("The 'select' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/set.spec.js b/test/commands/set.spec.js index 3235d634f6..8cf6fe6cd1 100644 --- a/test/commands/set.spec.js +++ b/test/commands/set.spec.js @@ -22,13 +22,11 @@ describe("The 'set' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.quit(); }); - client.on('end', function () { - return done(); - }); + client.on('end', done); }); it("reports an error", function (done) { @@ -43,7 +41,7 @@ describe("The 'set' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { done(); }); diff --git a/test/commands/setex.spec.js b/test/commands/setex.spec.js index 575c7e854d..72019ae926 100644 --- a/test/commands/setex.spec.js +++ b/test/commands/setex.spec.js @@ -13,7 +13,7 @@ describe("The 'setex' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/setnx.spec.js b/test/commands/setnx.spec.js index d72c36696e..5468463b0a 100644 --- a/test/commands/setnx.spec.js +++ b/test/commands/setnx.spec.js @@ -12,7 +12,7 @@ describe("The 'setnx' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/sinter.spec.js b/test/commands/sinter.spec.js index 8e547923db..bd7c934fdc 100644 --- a/test/commands/sinter.spec.js +++ b/test/commands/sinter.spec.js @@ -13,7 +13,7 @@ describe("The 'sinter' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/sinterstore.spec.js b/test/commands/sinterstore.spec.js index d4a0c228a4..434bab9a60 100644 --- a/test/commands/sinterstore.spec.js +++ b/test/commands/sinterstore.spec.js @@ -13,7 +13,7 @@ describe("The 'sinterstore' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/sismember.spec.js b/test/commands/sismember.spec.js index 8f556e741f..0ba5af6402 100644 --- a/test/commands/sismember.spec.js +++ b/test/commands/sismember.spec.js @@ -12,7 +12,7 @@ describe("The 'sismember' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/slowlog.spec.js b/test/commands/slowlog.spec.js index b297a985f7..e381ca28cf 100644 --- a/test/commands/slowlog.spec.js +++ b/test/commands/slowlog.spec.js @@ -13,7 +13,7 @@ describe("The 'slowlog' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/smembers.spec.js b/test/commands/smembers.spec.js index c19efc2c81..aab0989579 100644 --- a/test/commands/smembers.spec.js +++ b/test/commands/smembers.spec.js @@ -13,7 +13,7 @@ describe("The 'smembers' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/smove.spec.js b/test/commands/smove.spec.js index 436069be6a..ca2c6ae256 100644 --- a/test/commands/smove.spec.js +++ b/test/commands/smove.spec.js @@ -12,7 +12,7 @@ describe("The 'smove' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/sort.spec.js b/test/commands/sort.spec.js index 28355d9fe8..1a72664d9e 100644 --- a/test/commands/sort.spec.js +++ b/test/commands/sort.spec.js @@ -40,7 +40,7 @@ describe("The 'sort' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("error", done); client.once("connect", function () { client.flushdb(); diff --git a/test/commands/spop.spec.js b/test/commands/spop.spec.js index b44d9b172b..224869e5b6 100644 --- a/test/commands/spop.spec.js +++ b/test/commands/spop.spec.js @@ -13,7 +13,7 @@ describe("The 'spop' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/srem.spec.js b/test/commands/srem.spec.js index dc79134d63..7db8b6a847 100644 --- a/test/commands/srem.spec.js +++ b/test/commands/srem.spec.js @@ -13,7 +13,7 @@ describe("The 'srem' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/sunion.spec.js b/test/commands/sunion.spec.js index deb751b1af..835c258f21 100644 --- a/test/commands/sunion.spec.js +++ b/test/commands/sunion.spec.js @@ -13,7 +13,7 @@ describe("The 'sunion' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/sunionstore.spec.js b/test/commands/sunionstore.spec.js index 54cdddf52e..cbef9084fe 100644 --- a/test/commands/sunionstore.spec.js +++ b/test/commands/sunionstore.spec.js @@ -13,7 +13,7 @@ describe("The 'sunionstore' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/ttl.spec.js b/test/commands/ttl.spec.js index 1df47cfe31..3448fcf135 100644 --- a/test/commands/ttl.spec.js +++ b/test/commands/ttl.spec.js @@ -13,7 +13,7 @@ describe("The 'ttl' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/type.spec.js b/test/commands/type.spec.js index 5e592054d0..b6336153ef 100644 --- a/test/commands/type.spec.js +++ b/test/commands/type.spec.js @@ -12,7 +12,7 @@ describe("The 'type' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/watch.spec.js b/test/commands/watch.spec.js index 3cc28334f8..7214c9c8f3 100644 --- a/test/commands/watch.spec.js +++ b/test/commands/watch.spec.js @@ -15,7 +15,7 @@ describe("The 'watch' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/zadd.spec.js b/test/commands/zadd.spec.js index 9536b2688a..669d7a0641 100644 --- a/test/commands/zadd.spec.js +++ b/test/commands/zadd.spec.js @@ -13,7 +13,7 @@ describe("The 'zadd' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/zscan.spec.js b/test/commands/zscan.spec.js index 0794b8941a..b7a5936f30 100644 --- a/test/commands/zscan.spec.js +++ b/test/commands/zscan.spec.js @@ -13,7 +13,7 @@ describe("The 'zscan' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/commands/zscore.spec.js b/test/commands/zscore.spec.js index 6bfd279668..8a285fba9d 100644 --- a/test/commands/zscore.spec.js +++ b/test/commands/zscore.spec.js @@ -13,7 +13,7 @@ describe("The 'zscore' method", function () { var client; beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(done); }); diff --git a/test/connection.spec.js b/test/connection.spec.js index 65bcd0b6c8..71ecf1c9b5 100644 --- a/test/connection.spec.js +++ b/test/connection.spec.js @@ -135,7 +135,7 @@ describe("connection tests", function () { }); it("emits error once if reconnecting after command has been executed but not yet returned without callback", function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.on('error', function(err) { assert.strictEqual(err.code, 'UNCERTAIN_STATE'); done(); @@ -296,7 +296,7 @@ describe("connection tests", function () { }); it("connects correctly with args", function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.on("error", done); client.once("ready", function () { @@ -382,7 +382,7 @@ describe("connection tests", function () { }); it("connects correctly even if the info command is not present on the redis server", function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.info = function (cb) { // Mock the result cb(new Error("ERR unknown command 'info'")); @@ -465,7 +465,7 @@ describe("connection tests", function () { } it("redis still loading <= 1000ms", function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); var tmp = client.info.bind(client); var end = helper.callFuncAfter(done, 3); var delayed = false; @@ -495,7 +495,7 @@ describe("connection tests", function () { }); it("redis still loading > 1000ms", function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); var tmp = client.info.bind(client); var end = helper.callFuncAfter(done, 3); var delayed = false; diff --git a/test/detect_buffers.spec.js b/test/detect_buffers.spec.js index c8f0f134d8..a7c97eac11 100644 --- a/test/detect_buffers.spec.js +++ b/test/detect_buffers.spec.js @@ -16,7 +16,7 @@ describe("detect_buffers", function () { }); beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("error", done); client.once("connect", function () { client.flushdb(function (err) { diff --git a/test/multi.spec.js b/test/multi.spec.js index 849071a723..20be0325a7 100644 --- a/test/multi.spec.js +++ b/test/multi.spec.js @@ -105,13 +105,11 @@ describe("The 'multi' method", function () { describe("when not connected", function () { beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.quit(); }); - client.once('end', function () { - return done(); - }); + client.once('end', done); }); it("reports an error", function (done) { @@ -133,7 +131,7 @@ describe("The 'multi' method", function () { describe("when connected", function () { beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("connect", done); }); @@ -212,7 +210,7 @@ describe("The 'multi' method", function () { describe("when ready", function () { beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("ready", function () { client.flushdb(function (err) { return done(err); diff --git a/test/node_redis.spec.js b/test/node_redis.spec.js index 09d64a8d02..44dc40f78f 100644 --- a/test/node_redis.spec.js +++ b/test/node_redis.spec.js @@ -19,7 +19,7 @@ describe("The node_redis client", function () { describe("when connected", function () { beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.once("connect", function () { client.flushdb(done); }); @@ -343,7 +343,23 @@ describe("The node_redis client", function () { domain.on('error', function (err) { assert.strictEqual(err.message, 'ohhhh noooo'); domain.exit(); - return done(); + done(); + }); + }); + + it('catches all errors from within the domain', function (done) { + var domain = require('domain').create(); + + domain.run(function () { + // Trigger an error within the domain + client.end(true); + client.set('domain', 'value'); + }); + + domain.on('error', function (err) { + assert.strictEqual(err.message, 'SET can\'t be processed. The connection has already been closed.'); + domain.exit(); + done(); }); }); }); @@ -351,7 +367,7 @@ describe("The node_redis client", function () { describe('monitor', function () { it('monitors commands on all other redis clients', function (done) { - var monitorClient = redis.createClient.apply(redis.createClient, args); + var monitorClient = redis.createClient.apply(null, args); var responses = []; monitorClient.monitor(function (err, res) { @@ -474,7 +490,7 @@ describe("The node_redis client", function () { }); it("fires client.on('ready')", function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.on("ready", function () { assert.strictEqual(true, client.options.socket_nodelay); client.quit(); @@ -486,7 +502,7 @@ describe("The node_redis client", function () { }); it('client is functional', function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.on("ready", function () { assert.strictEqual(true, client.options.socket_nodelay); client.set(["set key 1", "set val"], helper.isString("OK")); @@ -508,7 +524,7 @@ describe("The node_redis client", function () { }); it("fires client.on('ready')", function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.on("ready", function () { assert.strictEqual(false, client.options.socket_nodelay); client.quit(); @@ -520,7 +536,7 @@ describe("The node_redis client", function () { }); it('client is functional', function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.on("ready", function () { assert.strictEqual(false, client.options.socket_nodelay); client.set(["set key 1", "set val"], helper.isString("OK")); @@ -539,7 +555,7 @@ describe("The node_redis client", function () { describe('defaults to true', function () { it("fires client.on('ready')", function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.on("ready", function () { assert.strictEqual(true, client.options.socket_nodelay); client.quit(); @@ -551,7 +567,7 @@ describe("The node_redis client", function () { }); it('client is functional', function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.on("ready", function () { assert.strictEqual(true, client.options.socket_nodelay); client.set(["set key 1", "set val"], helper.isString("OK")); @@ -599,7 +615,7 @@ describe("The node_redis client", function () { describe('protocol error', function () { it("should gracefully recover and only fail on the already send commands", function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); client.on('error', function(err) { assert.strictEqual(err.message, 'Protocol error, got "a" as reply type byte'); // After the hard failure work properly again. The set should have been processed properly too diff --git a/test/return_buffers.spec.js b/test/return_buffers.spec.js index 029103abb5..ab12668c59 100644 --- a/test/return_buffers.spec.js +++ b/test/return_buffers.spec.js @@ -17,7 +17,7 @@ describe("return_buffers", function () { }); beforeEach(function (done) { - client = redis.createClient.apply(redis.createClient, args); + client = redis.createClient.apply(null, args); var i = 1; if (args[2].detect_buffers) { // Test if detect_buffer option was deactivated diff --git a/test/tls.spec.js b/test/tls.spec.js index 8caddf816f..0fb051cf67 100644 --- a/test/tls.spec.js +++ b/test/tls.spec.js @@ -111,7 +111,7 @@ describe("TLS connection tests", function () { tls: faulty_cert }); client.on('error', function (err) { - assert.strictEqual(err.code, 'DEPTH_ZERO_SELF_SIGNED_CERT'); + assert(/DEPTH_ZERO_SELF_SIGNED_CERT/.test(err.code || err.message), err); client.end(true); }); client.set('foo', 'bar', function (err, res) {