@fastify/redis
Advanced tools
Comparing version 6.1.1 to 6.2.0
@@ -121,3 +121,3 @@ 'use strict' | ||
client.ping() | ||
client.ping().catch(onError) | ||
} | ||
@@ -124,0 +124,0 @@ } |
{ | ||
"name": "@fastify/redis", | ||
"version": "6.1.1", | ||
"version": "6.2.0", | ||
"description": "Plugin to share a common Redis connection across Fastify.", | ||
"main": "index.js", | ||
"type": "commonjs", | ||
"types": "types/index.d.ts", | ||
@@ -11,2 +12,3 @@ "scripts": { | ||
"redis": "docker run -p 6379:6379 --rm redis", | ||
"valkey": "docker run -p 6379:6379 --rm valkey/valkey:7.2", | ||
"test": "npm run unit && npm run typescript", | ||
@@ -38,3 +40,3 @@ "typescript": "tsd", | ||
"@fastify/pre-commit": "^2.0.2", | ||
"@types/node": "^18.0.0", | ||
"@types/node": "^20.1.0", | ||
"fastify": "^4.0.0-rc.2", | ||
@@ -44,3 +46,3 @@ "proxyquire": "^2.1.3", | ||
"tap": "^16.0.0", | ||
"tsd": "^0.28.0", | ||
"tsd": "^0.31.0", | ||
"why-is-node-running": "^2.2.2" | ||
@@ -47,0 +49,0 @@ }, |
@@ -493,4 +493,33 @@ 'use strict' | ||
test('catch .ping() errors', (t) => { | ||
t.plan(2) | ||
const fastify = Fastify() | ||
const fastifyRedis = proxyquire('..', { | ||
ioredis: function Redis (path, options) { | ||
this.ping = () => { | ||
return Promise.reject(new Redis.ReplyError('ping error')) | ||
} | ||
this.quit = () => {} | ||
this.info = cb => cb(null, 'info') | ||
this.on = function (name, handler) { | ||
return this | ||
} | ||
this.off = function () { return this } | ||
return this | ||
} | ||
}) | ||
fastify.register(fastifyRedis) | ||
fastify.ready((err) => { | ||
t.ok(err) | ||
t.equal(err.message, 'ping error') | ||
fastify.close() | ||
}) | ||
}) | ||
setInterval(() => { | ||
whyIsNodeRunning() | ||
}, 5000).unref() |
Sorry, the diff of this file is not supported yet
27450
12
606