10 Best JavaScript Mocking Libraries

List hand-picked by Openbase Experts
Learn More

ng-mocks

ng-mocks

Angular testing library for mocking components, directives, pipes, services and facilitating TestBed setup

MIT
TypeScript Icon
TypeScript Definitions: Built-In
GitHub Stars
765
Weekly Downloads
225K
Last Commit
5mos ago
User Rating
5.0/ 5
1
Top Feedback
1Great Documentation
1Easy to Use
1Highly Customizable
msw

msw

Seamless REST/GraphQL API mocking library for browser and Node.js.

MIT
TypeScript Icon
TypeScript Definitions: Built-In
GitHub Stars
11.1K
Weekly Downloads
1.4M
Last Commit
9mos ago
User Rating
4.9/ 5
8
Top Feedback
6Great Documentation
6Easy to Use
6Bleeding Edge
sinon

sinon

Test spies, stubs and mocks for JavaScript.

BSD-3-Clause
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
GitHub Stars
9.2K
Weekly Downloads
5M
Last Commit
8mos ago
User Rating
4.1/ 5
13
Top Feedback
4Great Documentation
4Easy to Use
1Performant
nock

nock

HTTP server mocking and expectations library for Node.js

MIT
TypeScript Icon
TypeScript Definitions: Built-In
GitHub Stars
11.6K
Weekly Downloads
2.2M
Last Commit
9mos ago
User Rating
4.7/ 5
6
Top Feedback
3Great Documentation
2Easy to Use
1Highly Customizable
json-schema-faker

json-schema-faker

JSON-Schema + fake data generators

MIT
TypeScript Icon
TypeScript Definitions: Built-In
GitHub Stars
2.9K
Weekly Downloads
188K
Last Commit
9mos ago
User Rating
5.0/ 5
1
Top Feedback
fak

faker

What really happened with Aaron Swartz?

MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
GitHub Stars
1.6K
Weekly Downloads
2.3M
Last Commit
1yr ago
User Rating
4.6/ 5
204
Top Feedback
35Easy to Use
31Great Documentation
24Highly Customizable
ama

axios-mock-adapter

Axios adapter that allows to easily mock requests

MIT
TypeScript Icon
TypeScript Definitions: Built-In
GitHub Stars
3.1K
Weekly Downloads
857K
Last Commit
1yr ago
User Rating
5.0/ 5
2
Top Feedback
2Easy to Use
1Great Documentation
1Performant
camouflage-server

camouflage-server

Camouflage is a backend mocking tool for HTTP, gRPC, Websockets and Thrift protocols, which helps you carry out your front end prototyping, unit testing, functional/performance testing in silos, in absence of one or more Microservices/APIs.

MIT
TypeScript Icon
TypeScript Definitions: Not Found
GitHub Stars
175
Weekly Downloads
2K
Last Commit
9mos ago
User Rating
5.0/ 5
1
Top Feedback
cas

casual

Fake data generator for javascript

MIT
TypeScript Icon
TypeScript Definitions: Not Found
GitHub Stars
2.9K
Weekly Downloads
96.4K
Last Commit
1yr ago
User Rating
5.0/ 5
1
Top Feedback
1Great Documentation
1Easy to Use
mas

mock-aws-s3

Library to mock the AWS SDK for Node.js

Unknown
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
GitHub Stars
105
Weekly Downloads
47.4K
Last Commit
2yrs ago
User Rating
5.0/ 5
1
Top Feedback
moc

mockjs

A simulation data generator

Unknown
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
GitHub Stars
18.6K
Weekly Downloads
62.4K
Last Commit
3yrs ago
User Rating
4.4/ 5
16
Top Feedback
mox

moxios

Mock axios requests for testing

MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
GitHub Stars
Weekly Downloads
105K
Last Commit
User Rating
4.0/ 5
1
Top Feedback
rnf

react-native-fetch-mock

fetch mock for react-native

MIT
TypeScript Icon
TypeScript Definitions: Not Found
GitHub Stars
41
Weekly Downloads
70
Last Commit
1yr ago
User Rating
5.0/ 5
1
Top Feedback
jso

jsonplaceholder

A simple online fake REST API server

MIT
TypeScript Icon
TypeScript Definitions: Not Found
GitHub Stars
4.5K
Weekly Downloads
32
Last Commit
1yr ago
User Rating
5.0/ 5
2
Top Feedback
1Great Documentation
camoswag

camoswag

Camouflage is a backend mocking tool for HTTP, gRPC and Websockets protocols, which helps you carry out your front end prototyping, unit testing, functional/performance testing in silos, in absence of one or more Microservices/APIs.

MIT
TypeScript Icon
TypeScript Definitions: Not Found
GitHub Stars
11
Weekly Downloads
3
Last Commit
User Rating
5.0/ 5
1
Top Feedback
exp

@jest-mock/express

A lightweight Jest mock for unit testing Express

MIT
TypeScript Icon
TypeScript Definitions: Built-In
GitHub Stars
32
Weekly Downloads
61.1K
Last Commit
6mos ago
nrm

next-router-mock

Mock implementation of the Next.js Router

MIT
TypeScript Icon
TypeScript Definitions: Built-In
GitHub Stars
201
Weekly Downloads
130K
Last Commit
7mos ago
ms

mock-socket

Javascript mocking library for WebSockets and Socket.IO

MIT
TypeScript Icon
TypeScript Definitions: Not Found
GitHub Stars
706
Weekly Downloads
411K
Last Commit
10mos ago
jma

jest-mock-axios

Axios mock for Jest

MIT
TypeScript Icon
TypeScript Definitions: Built-In
GitHub Stars
221
Weekly Downloads
106K
Last Commit
8mos ago
testdouble

testdouble

A minimal test double library for TDD with JavaScript

MIT
TypeScript Icon
TypeScript Definitions: Built-In
GitHub Stars
1.3K
Weekly Downloads
51.5K
Last Commit
7mos ago
jlm

jest-localstorage-mock

A module to mock window.localStorage and window.sessionStorage in Jest

BSD-3-Clause
TypeScript Icon
TypeScript Definitions: Not Found
GitHub Stars
300
Weekly Downloads
363K
Last Commit
8mos ago
jfm

jest-fetch-mock

Jest mock for fetch

MIT
TypeScript Icon
TypeScript Definitions: Built-In
GitHub Stars
776
Weekly Downloads
667K
Last Commit
9mos ago
nmh

node-mocks-http

Mock 'http' objects for testing Express routing functions

MIT
TypeScript Icon
TypeScript Definitions: Built-In
GitHub Stars
680
Weekly Downloads
335K
Last Commit
1yr ago
rm

redis-mock

Node.js redis client mock

MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
GitHub Stars
192
Weekly Downloads
148K
Last Commit
2yrs ago
xm

xhr-mock

Utility for mocking XMLHttpRequest.

MIT
TypeScript Icon
TypeScript Definitions: Built-In
GitHub Stars
192
Weekly Downloads
132K
Last Commit
2yrs ago
ome

openapi-mock-express-middleware

Generates express mock-servers from OpenAPI specs

MIT
TypeScript Icon
TypeScript Definitions: Built-In
GitHub Stars
18
Weekly Downloads
727
Last Commit
10mos ago
mer

mock-express-request

Nodejs library to mock express http request

MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
GitHub Stars
24
Weekly Downloads
73.8K
Last Commit
5yrs ago
mer

mock-express-response

Nodejs library to mock expressjs http response

MIT
TypeScript Icon
TypeScript Definitions: Not Found
GitHub Stars
24
Weekly Downloads
62.3K
Last Commit
2yrs ago
mk

mock-knex

a knex mock adapter for simulating a db during testing

MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
GitHub Stars
Weekly Downloads
33.6K
Last Commit
mimic

mimic

Seamless client side mocking

MIT
TypeScript Icon
TypeScript Definitions: Not Found
GitHub Stars
385
Weekly Downloads
8.6K
Last Commit
3yrs ago
graphql-faker

graphql-faker

🎲 Mock or extend your GraphQL API with faked data. No coding required.

MIT
TypeScript Icon
TypeScript Definitions: Not Found
GitHub Stars
2.5K
Weekly Downloads
3.5K
Last Commit
dys

dyson

Node server for dynamic, fake JSON.

Unknown
TypeScript Icon
TypeScript Definitions: Not Found
GitHub Stars
835
Weekly Downloads
2.4K
Last Commit
1yr ago
lineman

lineman

Lineman helps you build fat-client JavaScript apps. It produces happiness by building assets, mocking servers, running specs on every file change

MIT
TypeScript Icon
TypeScript Definitions: Not Found
GitHub Stars
1.2K
Weekly Downloads
2.3K
Last Commit
2yrs ago
dj

dummy-json

Generates random dummy JSON data in Node.js

MIT
TypeScript Icon
TypeScript Definitions: Built-In
GitHub Stars
372
Weekly Downloads
1.7K
Last Commit
1yr ago
kakapo

kakapo

🐦 Next generation mocking framework in Javascript

MIT
TypeScript Icon
TypeScript Definitions: Built-In
GitHub Stars
532
Weekly Downloads
866
Last Commit
2yrs ago
api

apimocker

node.js module to run a simple http server for mock service responses.

MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
GitHub Stars
272
Weekly Downloads
766
Last Commit
3yrs ago
gpt

gatsby-plugin-testing

Gatsby plugin enabling unit testing of Graph QL components

ISC
TypeScript Icon
TypeScript Definitions: Not Found
GitHub Stars
7
Weekly Downloads
204
Last Commit
1yr ago
shm

shmock

Simple HTTP Mocking Library

MIT
TypeScript Icon
TypeScript Definitions: Not Found
GitHub Stars
102
Weekly Downloads
88
Last Commit
7yrs ago
service-mocker

service-mocker

🚀 Next generation frontend API mocking framework

MIT
TypeScript Icon
TypeScript Definitions: Built-In
GitHub Stars
1K
Weekly Downloads
32
Last Commit
5yrs ago
emh

express-mocks-http

Mock 'http' objects for testing Express routing functions

Unknown
TypeScript Icon
TypeScript Definitions: Not Found
GitHub Stars
680
Weekly Downloads
31
Last Commit
1yr ago
moc

mockapi

A quick and dirty api framework in node. Great for quickly mocking out or prototyping an api.

MIT
TypeScript Icon
TypeScript Definitions: Not Found
GitHub Stars
13
Weekly Downloads
13
Last Commit
7yrs ago
@loremipsum/mocking-hans

@loremipsum/mocking-hans

You don't mock the Hans, he's mocking you.

MIT
TypeScript Icon
TypeScript Definitions: Built-In
GitHub Stars
24
Weekly Downloads
2
Last Commit
3yrs ago
nma

nextjs-mock-app

A typed mock NextJS app for use with testing suites like Jest.

MIT
TypeScript Icon
TypeScript Definitions: Not Found
GitHub Stars
0
Weekly Downloads
1
Last Commit
4yrs ago