{"id":46200,"library":"redmock","title":"RedMock","description":"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.","status":"maintenance","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/smokerbag/redmock","tags":["javascript"],"install":[{"cmd":"npm install redmock","lang":"bash","label":"npm"},{"cmd":"yarn add redmock","lang":"bash","label":"yarn"},{"cmd":"pnpm add redmock","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"RedMock uses CommonJS; no default ESM export.","wrong":"import RedisServer from 'redmock';","symbol":"RedisServer","correct":"const RedisServer = require('redmock');"},{"note":"Constructor takes no arguments; port is hardcoded or configurable via start() options.","wrong":"new RedisServer(port);","symbol":"RedisServer","correct":"const server = new RedisServer();"}],"quickstart":{"code":"const RedisServer = require('redmock');\n\nconst server = new RedisServer();\n\nserver.start().then(() => {\n  console.log('Mock Redis server started');\n  // Now connect your Redis client to localhost:6379\n  return server.stop();\n}).then(() => {\n  console.log('Server stopped');\n}).catch(err => {\n  console.error('Error:', err);\n});","lang":"javascript","description":"Shows starting and stopping the mock Redis server using promises."},"warnings":[{"fix":"Check the source code for supported commands or use a more complete mock like ioredis-mock.","message":"RedMock does not support all Redis commands; only a subset is implemented. Test against a real Redis server for full coverage.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider using an actively maintained alternative such as ioredis-mock or redis-mock.","message":"Version 1.0.0 is the latest but has not been updated since 2018. No new features or bug fixes are expected.","severity":"deprecated","affected_versions":"1.0.0"},{"fix":"Always call .catch() on start() and ignore stop() rejection if unhandled.","message":"Start and stop methods return promises; errors from start must be caught, but stop errors are swallowed.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.0':26 '5.7.0':37 'activ':64 'allow':12 'altern':67 'basic':28 'behav':50 'bug':58 'client':23 'cluster':33 'code':19 'command':30 'depend':18 'develop':13 'in-memori':45 'integr':57 'ioredi':70 'ioredis-mock':69 'javascript':81 'librari':24 'like':51,68 'longer':63 'maintain':65 'memori':47 'mock':5,71,75 'newer':79 'node':36 'node.js':9 'project':60,80 'provid':42 'real':44 'recommend':77 'redi':6,17,29,52,74 'redis-depend':16 'redis-mock':73 'redmock':1,2,41 'reduc':53 'requir':35 'risk':55 'sentinel':31 'server':7,48 'simpl':39 'stub':21,40 'support':27 'test':11,15 'unit':10 'unlik':38 'version':25 'without':20","created_at":"2026-06-07T12:58:46.537980+00:00","updated_at":"2026-06-07T12:58:46.537980+00:00","problems":[{"fix":"Stop the existing Redis server or change the port via environment variable or start() options.","cause":"Default port 6379 is already in use by another process (e.g., real Redis).","error":"Error: listen EADDRINUSE :::6379"},{"fix":"Use const RedisServer = require('redmock');","cause":"Loading the module incorrectly (e.g., import instead of require).","error":"RedisServer is not a constructor"},{"fix":"Instantiate with 'new RedisServer()' before calling start().","cause":"Forgot to call 'new RedisServer()' or used wrong variable.","error":"TypeError: redisServer.start is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/smokerbag/redmock#readme","github":"https://github.com/smokerbag/redmock","docs":null,"changelog":null,"pypi":null,"npm":"redmock","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}