Node-redis-mock is a minimal mock implementation of the popular node_redis client for unit testing code that depends on Redis operations. Version 0.2.16 is the latest stable release, with last publish in 2015. It simulates Redis commands in-memory without requiring a running Redis instance. Key differentiators include support for a subset of Redis commands covering strings, hashes, lists, keys, pub/sub, transactions, and server commands. However, it lacks many modern ioredis features and is unmaintained, making it suitable only for legacy projects using node_redis. Release cadence is irregular; no updates in years.
npm install node-redis-mockNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic set/get operations using callback style with node-redis-mock.
Migrate to a maintained mock like redis-mock (newer fork) or ioredis-mock.
Check the implemented commands list and add mocks for missing ones, or switch to a more complete mock.
Do not rely on dbsize for accurate key counts in tests.
Ensure npm install node-redis-mock yields the correct package.
Run 'npm install node-redis-mock' and verify package.json.
Use CommonJS require: var redis = require('node-redis-mock');Add a manual stub or switch to a mock with broader command support.
Call client.emit('ready') manually or ensure client.connect() is called if mock supports it.No dependency data recorded yet.