Mock Service Worker
API mocking library for seamless request interception in tests and development.
Testing npm MIT
Used in agent projects
100
0.8% of 12,697 public repos built with AI coding agents
Rank in testing
#12 of 40
by use in those projects
Downloads
22.7M
npm, last 7 days, msw
GitHub stars
18.3K
last push Oct 10, 2026
How Mock Service Worker is used
Mock Service Worker is a dependency in 100 of the 12,697 public GitHub projects set up for AI coding agents that we scanned (0.8%), #12 of 40 in testing. The most used alternative there is Vitest. Projects that use it most often also use Vitest (75.0%), Testing Library (74.0%), Playwright (JavaScript) (63.0%).
Often used with Mock Service Worker
| Vitest | 75.0% of Mock Service Worker projects · 6.1× more than average |
|---|---|
| Testing Library | 74.0% of Mock Service Worker projects · 10.3× more than average |
| Playwright (JavaScript) | 63.0% of Mock Service Worker projects · 7.2× more than average |
| jsdom | 54.0% of Mock Service Worker projects · 10.1× more than average |
| Vite | 67.0% of Mock Service Worker projects · 2.9× more than average |
| Zod | 57.0% of Mock Service Worker projects · 3.4× more than average |
| tsx | 43.0% of Mock Service Worker projects · 4.3× more than average |
| Prettier | 54.0% of Mock Service Worker projects · 3.1× more than average |
By coding agent
| Claude Code | 2.1% of projects set up for it |
|---|---|
| Cursor | 1.6% of projects set up for it |
| GitHub Copilot | 1.3% of projects set up for it |
| OpenAI Codex | 2.7% of projects set up for it |
| Gemini CLI | 1.6% of projects set up for it |
| OpenCode | 1.9% of projects set up for it |
Share of public repos configured for each agent that list Mock Service Worker as a dependency.
Install
| Package | npm install msw |
|---|---|
| Main stacks | TypeScript / JavaScript (55), Next.js (36), PHP (4), React Native / Expo (1) |
| Example projects | rajyraman/Levelup-for-Dynamics-CRM, Asvarox/allkaraoke, storybookjs/mealdrop, bartstc/vite-ts-react-template, bitrise-io/bitrise-workflow-editor |
Alternatives to Mock Service Worker
| Tool | Used in agent projects | Downloads / wk | GitHub stars | License |
|---|---|---|---|---|
| Vitest npm Next-generation testing framework powered by Vite with native ESM. |
1,549 (12.2%) | 123M | 17.2K | MIT |
| Playwright (JavaScript) npm Cross-browser automation library for end-to-end testing. |
1,117 (8.8%) | 74.2M | 97.4K | Apache-2.0 |
| Testing Library npm Testing utilities for React encouraging testing user behavior. |
915 (7.2%) | 68.7M | 19.7K | MIT |
| Jest npm Delightful JavaScript testing framework with minimal configuration. |
702 (5.5%) | 46.3M | 45.6K | MIT |
| jsdom npm JavaScript implementation of web standards for testing DOM interactions. |
681 (5.4%) | 112M | 21.7K | MIT |
| pytest pypi Simple, powerful Python testing framework with fixtures and plugins. |
330 (2.6%) | 196M | 14.6K | — |
| Chai npm BDD/TDD assertion library for Node.js and browsers with expressive syntax. |
305 (2.4%) | 14M | 8,265 | MIT |
| Mocha npm Feature-rich JavaScript test framework for Node.js and browsers. |
281 (2.2%) | 12.6M | 22.9K | MIT |