Mock Service Worker
Metrics as of , from the GitHub or GitLab API of each repository. Refreshed monthly.
What Mock Service Worker is
Mock Service Worker (MSW) is an API mocking library for JavaScript. Request handlers use Express-like routing with parameters, wildcards and regular expressions. Handlers return custom status codes, headers, cookies, delays or resolvers. In the browser, setupWorker uses the Service Worker API to answer intercepted requests at the network level. In Node.js, setupServer applies a low-level interception algorithm to the same request handlers. Application code does not stub fetch or axios, so it runs unaware of mocking. The same mock definitions serve unit, integration and end-to-end tests, as well as local development.
Written from the project's README, read .
- Category
- Test data and mocking
- License
- MIT
- Language
- TypeScript
- Changelog
- Releases on GitHub
Repository metrics
Status
activeLast commit within 90 days of the fetch date.Computed from the last commit date and the archive flag on the fetch date. See the status rules.
Alternatives
Listed test data and mocking tools, same primary language first, then by GitHub stars. Each line gives one fact from the tool's documentation where it differs from Mock Service Worker's, with its source. See also Mock Service Worker alternatives.
@faker-js/faker: Languages for writing tests: JavaScript (browser and Node.js). source: Docs: Getting Started
Mockoon: Protocols: HTTP routes; WebSocket (ws:// and wss://). source: Docs: WebSockets
Prism: Protocols: HTTP. source: README
Testcontainers for Node.js: Languages for writing tests: Node.js. source: Docs: Testcontainers for Node.js
JSON Server: Protocols: HTTP (REST API routes for GET, POST, PUT, PATCH, DELETE). source: README
Faker: Languages for writing tests: Python (3.8 and above). source: README
Mockito: Languages for writing tests: Java. source: README
Nock: Languages for writing tests: Node.js. source: README
Comparisons
Questions
Is Mock Service Worker open source?
Yes. Mock Service Worker is released under MIT, an OSI-approved license, as reported by the GitHub API on 2026-09-22.
Is Mock Service Worker maintained?
On 2026-09-22, the last commit to the default branch was on 2026-09-08, so the listed status is active. Rule: Last commit within 90 days of the fetch date.
How many GitHub stars does Mock Service Worker have?
18,216 stars on 2026-09-22, from the GitHub API. The number is refreshed at each monthly update.
What language is Mock Service Worker written in?
The repository's primary language, as reported by the GitHub API, is TypeScript.
Sources
- GitHub REST API: repository, read
- GitHub REST API: commits, read
- GitHub REST API: latest release, read
- GitHub REST API: contributors, read
- README, read