16 best JavaScript Mock libraries in 2024
by marketing.admin@openweaver.com Updated: Mar 12, 2023
Guide Kit
A mock object of a given class or interface is designed to simulate the behavior of the real object. Used to test the behavior of other objects that are dependent on this mock object. A mock object returns dummy data corresponding to some dummy input passed to it. Mock objects can be used as a replacement for real objects in unit testing, they often also record how they were used so that you can make assertions about this after the test has finished. In this kit, we will discuss the top 8 JavaScript Mock Open Source libraries that you can use in your testing project. nock - HTTP server mocking and expectations library for Node.js; sinon - Test spies, stubs and mocks for JavaScript; easy-mock - persistent service that generates mock data quickly.
nockby nock
HTTP server mocking and expectations library for Node.js
nockby nock
JavaScript 12174 Version:v13.3.1 License: Permissive (MIT)
easy-mockby easy-mock
A persistent service that generates mock data quickly and provids visualization view.
easy-mockby easy-mock
JavaScript 8898 Version:v1.6.0 License: Strong Copyleft (GPL-3.0)
axios-mock-adapterby ctimmerm
Axios adapter that allows to easily mock requests
axios-mock-adapterby ctimmerm
JavaScript 3189 Version:v1.21.4 License: Permissive (MIT)
redux-mock-storeby reduxjs
A mock store for testing Redux async action creators and middleware.
redux-mock-storeby reduxjs
JavaScript 2478 Version:v1.5.3 License: Permissive (MIT)
fetch-mockby wheresrhys
Mock http requests made using fetch
fetch-mockby wheresrhys
JavaScript 1202 Version:v9.11.0 License: Permissive (MIT)
jest-fetch-mockby jefflau
There is a mock for fetch
jest-fetch-mockby jefflau
JavaScript 837 Version:3.0.0 License: Permissive (MIT)
mock-socketby thoov
Javascript mocking library for WebSockets and Socket.IO
mock-socketby thoov
JavaScript 741 Version:9.0.0 License: Permissive (MIT)
node-mocks-httpby howardabrams
Mock 'http' objects for testing Express routing functions
node-mocks-httpby howardabrams
JavaScript 609 Version:v1.10.0 License: Others (Non-SPDX)
react-mockby skidding
Declarative mocks for React state and global APIs
react-mockby skidding
JavaScript 369 Version:Current License: Permissive (MIT)
jest-localstorage-mockby clarkbw
A module to mock window.localStorage and window.sessionStorage in Jest
jest-localstorage-mockby clarkbw
JavaScript 289 Version:v2.3.0 License: Permissive (BSD-3-Clause)
vuex-mock-storeby posva
✅Simple and straightforward Vuex Store mock for vue-test-utils
vuex-mock-storeby posva
JavaScript 271 Version:0.0.8 License: Permissive (MIT)
ioredis-mockby stipsan
Emulates ioredis by performing all operations in-memory.
ioredis-mockby stipsan
JavaScript 289 Version:v8.6.0 License: Permissive (MIT)
node-mock-serverby smollweide
File based Node REST API mock server
node-mock-serverby smollweide
JavaScript 236 Version:0.25.4 License: Permissive (MIT)
mock-knexby jbrumwell
A mock knex adapter for simulating a database during testing
mock-knexby jbrumwell
JavaScript 230 Version:v0.4.12 License: Permissive (MIT)