10 Best JavaScript Mocking Libraries

Curated by the Openbase team and community.Learn more

Curated by the Openbase team and community. Learn more

nm

ng-mocks

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

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: Built-In
User Rating
5.0/ 5
1
Top Feedback
1Great Documentation
1Easy to Use
1Highly Customizable
GitHub Stars
511
Weekly Downloads
149K
Last Commit
3d ago
Bundle Size (min+gzip)
N/A
Not Tree-Shakeable
fak

faker

generate massive amounts of realistic fake data in Node.js and the browser

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User Rating
4.6/ 5
160
Top Feedback
33Easy to Use
29Great Documentation
23Highly Customizable
GitHub Stars
34K
Weekly Downloads
3M
Last Commit
7d ago
Bundle Size (min+gzip)
502.5KB
Not Tree-Shakeable

msw

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

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: Built-In
User Rating
4.8/ 5
6
Top Feedback
3Great Documentation
3Easy to Use
3Bleeding Edge
GitHub Stars
7K
Weekly Downloads
521K
Last Commit
21d ago
Bundle Size (min+gzip)
N/A
Tree-Shakeable

nock

HTTP server mocking and expectations library for Node.js

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: Built-In
User Rating
4.8/ 5
5
Top Feedback
3Great Documentation
2Easy to Use
1Highly Customizable
GitHub Stars
11K
Weekly Downloads
2M
Last Commit
7d ago
Bundle Size (min+gzip)
N/A
Not Tree-Shakeable

sinon

Test spies, stubs and mocks for JavaScript.

License Icon
License: BSD-3-Clause
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User Rating
4.0/ 5
10
Top Feedback
4Great Documentation
4Easy to Use
1Performant
GitHub Stars
9K
Weekly Downloads
4M
Last Commit
2mos ago
Bundle Size (min+gzip)
N/A
Tree-Shakeable

json-schema-faker

JSON-Schema + fake data generators

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: Built-In
User Rating
5.0/ 5
1
Top Feedback
N/A
GitHub Stars
3K
Weekly Downloads
131K
Last Commit
22d ago
Bundle Size (min+gzip)
N/A
Tree-Shakeable
ama

axios-mock-adapter

Axios adapter that allows to easily mock requests

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: Built-In
User Rating
5.0/ 5
2
Top Feedback
2Easy to Use
1Great Documentation
GitHub Stars
3K
Weekly Downloads
683K
Last Commit
8d ago
Bundle Size (min+gzip)
N/A
Not Tree-Shakeable
cas

casual

Fake data generator for javascript

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User Rating
5.0/ 5
1
Top Feedback
1Great Documentation
1Easy to Use
GitHub Stars
3K
Weekly Downloads
66K
Last Commit
4mos ago
Bundle Size (min+gzip)
184.6KB
Not Tree-Shakeable
mas

mock-aws-s3

Library to mock the AWS SDK for Node.js

License Icon
License: Unknown
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User Rating
5.0/ 5
1
Top Feedback
N/A
GitHub Stars
95
Weekly Downloads
29K
Last Commit
7mos ago
Bundle Size (min+gzip)
41.0KB
Not Tree-Shakeable
suc

suchjs

A fake data generator library, extendable, configurable,powerful, mock data as you want easily.

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: Built-In
User Rating
5.0/ 5
1
Top Feedback
1Easy to Use
1Highly Customizable
GitHub Stars
13
Weekly Downloads
37
Last Commit
14d ago
Bundle Size (min+gzip)
N/A
Not Tree-Shakeable
rnf

react-native-fetch-mock

fetch mock for react-native

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User Rating
5.0/ 5
1
Top Feedback
N/A
GitHub Stars
43
Weekly Downloads
316
Last Commit
4mos ago
Bundle Size (min+gzip)
52.2KB
Not Tree-Shakeable
moc

mockjs

A simulation data generator

License Icon
License: Unknown
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User Rating
4.9/ 5
7
Top Feedback
N/A
GitHub Stars
17K
Weekly Downloads
53K
Last Commit
2yrs ago
Bundle Size (min+gzip)
49.2KB
Not Tree-Shakeable
jso

jsonplaceholder

A simple online fake REST API server

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User Rating
5.0/ 5
1
Top Feedback
1Great Documentation
GitHub Stars
4K
Weekly Downloads
19
Last Commit
4mos ago
Bundle Size (min+gzip)
460.0KB
Not Tree-Shakeable
rm

redis-mock

Node.js redis client mock

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
171
Weekly Downloads
115K
Last Commit
10mos ago
Bundle Size (min+gzip)
6.71KB
Not Tree-Shakeable
ms

mock-socket

Javascript mocking library for WebSockets and Socket.IO

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
634
Weekly Downloads
179K
Last Commit
8d ago
Bundle Size (min+gzip)
N/A
Not Tree-Shakeable
exp

@jest-mock/express

A lightweight Jest mock for unit testing Express

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: Built-In
User RatingN/A
Top Feedback
N/A
GitHub Stars
18
Weekly Downloads
20K
Last Commit
1mo ago
Bundle Size (min+gzip)
N/A
Not Tree-Shakeable
nrm

next-router-mock

Mock implementation of the Next.js Router

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
63
Weekly Downloads
16K
Last Commit
9d ago
Bundle Size (min+gzip)
N/A
Not Tree-Shakeable
jlm

jest-localstorage-mock

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

License Icon
License: BSD-3-Clause
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
280
Weekly Downloads
325K
Last Commit
1mo ago
Bundle Size (min+gzip)
N/A
Tree-Shakeable
jfm

jest-fetch-mock

Jest mock for fetch

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: Built-In
User RatingN/A
Top Feedback
N/A
GitHub Stars
725
Weekly Downloads
593K
Last Commit
2mos ago
Bundle Size (min+gzip)
4.74KB
Not Tree-Shakeable
jma

jest-mock-axios

Axios mock for Jest

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: Built-In
User RatingN/A
Top Feedback
N/A
GitHub Stars
193
Weekly Downloads
91K
Last Commit
1mo ago
Bundle Size (min+gzip)
N/A
Not Tree-Shakeable
nmh

node-mocks-http

Mock 'http' objects for testing Express routing functions

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: Built-In
User RatingN/A
Top Feedback
N/A
GitHub Stars
631
Weekly Downloads
263K
Last Commit
2mos ago
Bundle Size (min+gzip)
N/A
Not Tree-Shakeable

testdouble

A minimal test double library for TDD with JavaScript

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: Built-In
User RatingN/A
Top Feedback
N/A
GitHub Stars
1K
Weekly Downloads
54K
Last Commit
2mos ago
Bundle Size (min+gzip)
N/A
Not Tree-Shakeable

moxios

Mock axios requests for testing

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
1K
Weekly Downloads
120K
Last Commit
7mos ago
Bundle Size (min+gzip)
3.31KB
Not Tree-Shakeable
ome

openapi-mock-express-middleware

Generates express mock server from Open API spec

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: Built-In
User RatingN/A
Top Feedback
N/A
GitHub Stars
12
Weekly Downloads
541
Last Commit
4mos ago
Bundle Size (min+gzip)
N/A
Not Tree-Shakeable
erm

express-request-mock

🖖 A convenient wrapper for node-mocks-http which makes testing Express controllers and middleware easy.

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: Built-In
User RatingN/A
Top Feedback
N/A
GitHub Stars
12
Weekly Downloads
3K
Last Commit
3mos ago
Bundle Size (min+gzip)
40.2KB
Not Tree-Shakeable
dys

dyson

Node server for dynamic, fake JSON.

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
827
Weekly Downloads
5K
Last Commit
5mos ago
Bundle Size (min+gzip)
N/A
Not Tree-Shakeable
mer

mock-express-response

Nodejs library to mock expressjs http response

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
24
Weekly Downloads
52K
Last Commit
10mos ago
Bundle Size (min+gzip)
85.6KB
Not Tree-Shakeable

graphql-faker

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

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
2K
Weekly Downloads
3K
Last Commit
4mos ago
Bundle Size (min+gzip)
N/A
Not Tree-Shakeable
dj

dummy-json

Generates random dummy JSON data in Node.js

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: Built-In
User RatingN/A
Top Feedback
N/A
GitHub Stars
363
Weekly Downloads
2K
Last Commit
4mos ago
Bundle Size (min+gzip)
N/A
Not Tree-Shakeable

mimic

Seamless client side mocking

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
382
Weekly Downloads
4K
Last Commit
6mos ago
Bundle Size (min+gzip)
282.0KB
Not Tree-Shakeable
mk

mock-knex

A mock knex adapter for simulating a database during testing

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
216
Weekly Downloads
40K
Last Commit
5mos ago
Bundle Size (min+gzip)
30.6KB
Not Tree-Shakeable
xm

xhr-mock

Utility for mocking XMLHttpRequest.

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: Built-In
User RatingN/A
Top Feedback
N/A
GitHub Stars
188
Weekly Downloads
117K
Last Commit
10mos ago
Bundle Size (min+gzip)
5.73KB
Not Tree-Shakeable
mer

mock-express-request

Nodejs library to mock express http request

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
24
Weekly Downloads
63K
Last Commit
4yrs ago
Bundle Size (min+gzip)
50.5KB
Not Tree-Shakeable

express-mock-api-middleware

Express middleware for mocking restful APIs

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
4
Weekly Downloads
451
Last Commit
3mos ago
Bundle Size (min+gzip)
448.0KB
Not Tree-Shakeable

lineman

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

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
1K
Weekly Downloads
573
Last Commit
5mos ago
Bundle Size (min+gzip)
75.6KB
Not Tree-Shakeable

express-oven

An easy mock API generator with express.js

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: Built-In
User RatingN/A
Top Feedback
N/A
GitHub Stars
N/A
Weekly Downloads
42
Last Commit
12d ago
Bundle Size (min+gzip)
N/A
Tree-Shakeable
gpt

gatsby-plugin-testing

Gatsby plugin enabling unit testing of Graph QL components

License Icon
License: ISC
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
7
Weekly Downloads
351
Last Commit
3mos ago
Bundle Size (min+gzip)
N/A
Not Tree-Shakeable

fake-data-generator

Just a small open-source script to create fake data given a simple JSON model.

License Icon
License: GPL-3.0
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
34
Weekly Downloads
122
Last Commit
7mos ago
Bundle Size (min+gzip)
491.9KB
Not Tree-Shakeable
emh

express-mocks-http

Mock 'http' objects for testing Express routing functions

License Icon
License: Unknown
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
631
Weekly Downloads
55
Last Commit
2mos ago
Bundle Size (min+gzip)
2.10KB
Not Tree-Shakeable
ems

express-mock-server

Mock server powered by Express.js

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
5
Weekly Downloads
167
Last Commit
5mos ago
Bundle Size (min+gzip)
N/A
Not Tree-Shakeable

@mediamonks/monck

Add highly configurable API mocks to your express server

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: Built-In
User RatingN/A
Top Feedback
N/A
GitHub Stars
1
Weekly Downloads
82
Last Commit
6mos ago
Bundle Size (min+gzip)
481.7KB
Tree-Shakeable
api

apimocker

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

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
270
Weekly Downloads
2K
Last Commit
2yrs ago
Bundle Size (min+gzip)
504.0KB
Not Tree-Shakeable

kakapo

🐦 Next generation mocking framework in Javascript

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: Built-In
User RatingN/A
Top Feedback
N/A
GitHub Stars
531
Weekly Downloads
978
Last Commit
1yr ago
Bundle Size (min+gzip)
15.9KB
Not Tree-Shakeable
rj

redis-js

Mock redis in pure javascript

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
34
Weekly Downloads
423
Last Commit
4yrs ago
Bundle Size (min+gzip)
9.8KB
Not Tree-Shakeable
smm

super-mock-middleware

an express mock data middleware

License Icon
License: ISC
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
1
Weekly Downloads
0
Last Commit
15d ago
Bundle Size (min+gzip)
290.0KB
Not Tree-Shakeable

service-mocker

🚀 Next generation frontend API mocking framework

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: Built-In
User RatingN/A
Top Feedback
N/A
GitHub Stars
1K
Weekly Downloads
93
Last Commit
4yrs ago
Bundle Size (min+gzip)
28.5KB
Not Tree-Shakeable

farso

express middleware library to mock http server

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
N/A
Weekly Downloads
26
Last Commit
1yr ago
Bundle Size (min+gzip)
248.2KB
Not Tree-Shakeable
xmo

xmock

A simple express-like http mocking for in-memory tests.

License Icon
License: ISC
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
2
Weekly Downloads
64
Last Commit
5yrs ago
Bundle Size (min+gzip)
18.5KB
Not Tree-Shakeable
shm

shmock

Simple HTTP Mocking Library

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: DefinitelyTyped
User RatingN/A
Top Feedback
N/A
GitHub Stars
103
Weekly Downloads
51
Last Commit
6yrs ago
Bundle Size (min+gzip)
N/A
Not Tree-Shakeable
req

reqresnext

Tiny helper for express middleware testing

License Icon
License: MIT
TypeScript Icon
TypeScript Definitions: Built-In
User RatingN/A
Top Feedback
N/A
GitHub Stars
5
Weekly Downloads
6
Last Commit
3mos ago
Bundle Size (min+gzip)
247.6KB
Not Tree-Shakeable