{"id":46104,"library":"redis-eval-mock","title":"redis-eval-mock","description":"A mock of Redis EVAL functionality for testing Lua scripts in Node.js. Version 1.0.1, last updated in 2019, with no active development. It integrates with existing redis mocks like redis-mock and provides mock implementations of cjson and cmsgpack libraries. It allows testing Lua scripts without a real Redis server, but note that evalsha always throws NOSCRIPT as there is no script cache. The package ships TypeScript types and has a peer dependency on @types/redis. It is a niche testing utility, not updated recently.","status":"maintenance","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/plsmphnx/redis-eval-mock","tags":["javascript","redis","lua","eval","mock","test","typescript"],"install":[{"cmd":"npm install redis-eval-mock","lang":"bash","label":"npm"},{"cmd":"yarn add redis-eval-mock","lang":"bash","label":"yarn"},{"cmd":"pnpm add redis-eval-mock","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for TypeScript type definitions","package":"@types/redis","optional":false}],"imports":[{"note":"The package is ESM-only with a default export. Using require may cause issues if the package does not export a CommonJS module.","wrong":"const mockEval = require('redis-eval-mock')","symbol":"default","correct":"import mockEval from 'redis-eval-mock'"},{"note":"The default export is a function; there is no named export 'mockEval'.","wrong":"import { mockEval } from 'redis-eval-mock'","symbol":"mockEval","correct":"import mockEval from 'redis-eval-mock'"},{"note":"The package does not export any types; you can use the types from @types/redis for the return value.","wrong":"No type imports available from this package","symbol":"Function","correct":"import type { Function } from ''; // Not exported"}],"quickstart":{"code":"import * as redis from 'redis';\nimport * as mock from 'redis-mock';\nimport mockEval from 'redis-eval-mock';\n\n// Set up mock Redis client with eval mocking\nconst client = mockEval(mock.createClient());\n\n// Now you can use eval as if it were real Redis\nclient.eval('return 1', 0, (err, result) => {\n  if (err) throw err;\n  console.log(result); // 1\n});\n\n// evalsha will always throw NOSCRIPT\nclient.evalsha('some-sha', 0, (err, result) => {\n  console.log(err.message); // NOSCRIPT No matching script\n});","lang":"typescript","description":"Creates a mocked Redis client with eval support for testing Lua scripts in Node.js."},"warnings":[{"fix":"If you need to test evalsha, you will need to extend the mock or use a different library.","message":"evalsha always throws NOSCRIPT error because the mock does not implement a script cache.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider testing with a real Redis instance or using alternatives like ioredis-mock.","message":"Package has not been updated since 2019 and may not work with newer versions of Node.js or TypeScript.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Install @types/redis as a dev dependency.","message":"The package relies on @types/redis as a peer dependency; without it, TypeScript compilation may fail.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use import syntax instead of require().","message":"In version 1.0.0, the package switched from CommonJS to ESM-only exports, breaking require() usage.","severity":"breaking","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.1':18 '2019':22 'activ':25 'allow':47 'alway':60 'cach':68 'cjson':42 'cmsgpack':44 'depend':78 'develop':26 'eval':3,9,93 'evalsha':59 'exist':30 'function':10 'implement':40 'integr':28 'javascript':90 'last':19 'librari':45 'like':33 'lua':13,49,92 'mock':4,6,32,36,39,94 'nich':84 'node.js':16 'noscript':62 'note':57 'packag':70 'peer':77 'provid':38 'real':53 'recent':89 'redi':2,8,31,35,54,91 'redis-eval-mock':1 'redis-mock':34 'script':14,50,67 'server':55 'ship':71 'test':12,48,85,95 'throw':61 'type':73 'types/redis':80 'typescript':72,96 'updat':20,88 'util':86 'version':17 'without':51","created_at":"2026-06-07T12:58:18.360347+00:00","updated_at":"2026-06-07T12:58:18.360347+00:00","problems":[{"fix":"Use `import mockEval from 'redis-eval-mock'` (without curly braces).","cause":"Using named import { mockEval } instead of default import.","error":"TypeError: mockEval is not a function"},{"fix":"Run `npm install --save-dev @types/redis`.","cause":"Missing peer dependency @types/redis.","error":"Cannot find module '@types/redis'"},{"fix":"If you need to test evalsha, consider using a different mocking strategy or a real Redis server.","cause":"The mock does not implement script caching, so evalsha always fails.","error":"Error: NOSCRIPT No matching script"}],"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/plsmphnx/redis-eval-mock#readme","github":"https://github.com/plsmphnx/redis-eval-mock","docs":null,"changelog":null,"pypi":null,"npm":"redis-eval-mock","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}}