Registry / testing / redmock

redmock

JSON →
library1.0.0jsnpmunverified

RedMock is a mock Redis server for Node.js unit tests, allowing developers to test Redis-dependent code without stubbing the client library. Version 1.0.0 supports basic Redis commands, sentinel, and clustering. It requires Node >= 5.7.0. Unlike simple stubs, RedMock provides a real in-memory server that behaves like Redis, reducing the risk of integration bugs. The project is no longer actively maintained, and alternatives like ioredis-mock or redis-mock are recommended for newer projects.

npm install redmock
INSTALL
IMPORT
SIG · REDMOCK
R
redmock
testingjavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RedisServer
✓ const RedisServer = require('redmock');
✗ import RedisServer from 'redmock';
RedMock uses CommonJS; no default ESM export.
RedisServer
✓ const server = new RedisServer();
✗ new RedisServer(port);
Constructor takes no arguments; port is hardcoded or configurable via start() options.

Shows starting and stopping the mock Redis server using promises.

const RedisServer = require('redmock'); const server = new RedisServer(); server.start().then(() => { console.log('Mock Redis server started'); // Now connect your Redis client to localhost:6379 return server.stop(); }).then(() => { console.log('Server stopped'); }).catch(err => { console.error('Error:', err); });
Debug
Known issues
gotchaRedMock does not support all Redis commands; only a subset is implemented. Test against a real Redis server for full coverage.
fix
Check the source code for supported commands or use a more complete mock like ioredis-mock.
affects: all
deprecatedVersion 1.0.0 is the latest but has not been updated since 2018. No new features or bug fixes are expected.
fix
Consider using an actively maintained alternative such as ioredis-mock or redis-mock.
affects: 1.0.0
gotchaStart and stop methods return promises; errors from start must be caught, but stop errors are swallowed.
fix
Always call .catch() on start() and ignore stop() rejection if unhandled.
affects: >=1.0.0
Errors
Common errors & fixes
Error: listen EADDRINUSE :::6379
Default port 6379 is already in use by another process (e.g., real Redis).
fix
Stop the existing Redis server or change the port via environment variable or start() options.
RedisServer is not a constructor
Loading the module incorrectly (e.g., import instead of require).
fix
Use const RedisServer = require('redmock');
TypeError: redisServer.start is not a function
Forgot to call 'new RedisServer()' or used wrong variable.
fix
Instantiate with 'new RedisServer()' before calling start().
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
redmock — npm install redmock · libregistry