A Fastify plugin that provides a shared in-memory Redis mock client for unit testing, built on top of ioredis-mock. Version 1.1.0 is the latest stable release. It mirrors the fastify-redis API, allowing seamless switching between real and mock Redis clients for testing without a live Redis server. Maintained with low release cadence.
npm install fastify-redis-mockNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Registers the fastify-redis-mock plugin and uses the mock client to get a key.
Use a single fastify instance if shared state is needed, or use a global mock store.
Check ioredis-mock documentation for supported commands. Mock only commands your code actually uses.
Use a wrapper function to normalize options depending on environment.
Guarantee registration in the root scope, or use fastify.after() to access redis.
Consider using fastify-redis with a local Redis instance or a dedicated test container.
Run `npm install fastify-redis-mock --save-dev` and check spelling.
Make sure to call `await fastify.register(redisMock)` before any route handlers or hooks that use redis.
Check the plugin's peerDependencies and install a compatible Fastify version.