# Mock Service Worker: 8.5 out of 10

A strong pick. 1st of 10 in [Mocking and test data](https://elestia.ai/opensource/mocking/index.md).

Mock Service Worker (MSW) mocks HTTP, GraphQL and WebSocket traffic at the network level. One set of handlers works in the browser, in Node.js and in development. It is the default choice for API mocking in JavaScript today. v3.0 came out in September 2026 and is ESM-only, so expect some migration work.

**Best for:** Web and full-stack TypeScript teams that want one set of network mocks for unit tests, browser tests, Storybook and local development.

## Scores

- **Overall: 8.5** (likely 7.5 to 9.2)
  - Claude Opus 5.5 (8.5): For mocking APIs in new JavaScript or TypeScript projects, MSW is the clear pick. It works in any environment and is well maintained. It is growing faster than its peers, and survey talks and independent write-ups back it. Two things hold it below 9: v3 is a fresh major release with many breaks, and it depends on one lead maintainer. It also covers only network mocking, so pair it with Vitest mocks or Faker for the rest of the category.
  - GPT-6.2 Sol (8.5): MSW is the first choice among these peers when a new project needs the same API mocks in a browser and Node.js. It has a stronger cross-environment fit than Nock, which remains a good choice for strict request expectations in Node-only tests. The young v3 release, upgrade friction, and dependence on one lead maintainer keep it below an across-the-board default.
- **Needed by many: 6.6** (likely 5.5 to 7.6)
  - Claude Opus 5.5 (6.5): Most developers who test web apps or services that call HTTP APIs need network mocking. It works in browsers and Node and with any test runner except Jest/JSDOM, which it no longer supports. It does not cover function spies or fake data, which are the other jobs in this category.
  - GPT-6.2 Sol (6.6): API mocking is useful to a large share of web and Node.js teams, and MSW works across frameworks. Its scope is network behavior, while function stubs and generated test data are covered by peers such as Sinon and Faker. Survey usage gives a sense of scale, though it does not measure how many teams need network mocks.
- **Helps a lot: 8.6** (likely 7.5 to 9.3)
  - Claude Opus 5.5 (8.5): Mocking at the network level with standard Request/Response objects makes tests close to real traffic. It works with any client, and the types are first-class. v3 adds navigation and form interception, GraphQL subscriptions and a Vite plugin. It also removes dependencies. Setup is heavier than Nock, and the major release is fresh, which keeps the range from going higher.
  - GPT-6.2 Sol (8.7): Version 3.0.7 ships typed handlers for HTTP, GraphQL, WebSockets, and server-sent events, with a versioned quick start. Independent tests show why MSW works well for shared mocks and why Nock is simpler for strict outbound request assertions. Older GraphQL examples can lead coding agents to generate invalid imports. Open reports of Node.js streaming regressions and limited comparative performance evidence keep the range wide.
- **Holds up over time: 7.7** (likely 6.5 to 8.8)
  - Claude Opus 5.5 (8.0): The project is very active: 123 commits and 36 releases in the year, a v3 release in November 2026, and an issue backlog of only 14. Many users are moving towards it. The risks are that it leans on one lead maintainer funded by sponsorships, and that major versions break code (v2 in 2023, v3 in 2026).
  - GPT-6.2 Sol (7.3): MSW made 123 commits and shipped 36 releases in the past year, ahead of Nock in commit activity, and November patches are still coming. Vite and Vitest help fund the work, but day-to-day maintenance relies heavily on one maintainer and the release team’s size is unclear. The ESM and Node.js changes in v3 add upgrade work despite a migration guide and codemods.
- **Used widely: 7.6** (likely 6.4 to 8.5)
  - Claude Opus 5.5 (8.5): It has 134.7M downloads in 4 weeks, the most in the category. That is up from 28.8M a year ago, a ratio of about 4.7 against the 4.1 median, so it is gaining ground. Faker grew 2.6x, Nock 1.7x and Sinon 1.6x. Some downloads come from other tools installing it. Its 11.9k dependent repos are far fewer than Nock's or Sinon's, which reflects their longer history more than current choice.
  - GPT-6.2 Sol (6.7): Four-week npm downloads grew 4.68× year over year, above the 4.1× catalog median and faster than every listed peer. Ecosyste.ms found about 11,900 repositories and 2,200 packages, with far fewer indexed repositories than Nock or Sinon. MSW leads the peer set on Bluesky links, though its top posts are maintainer updates. Repeated installs and heavy use of v2 make the number of new projects choosing v3 uncertain.
- **Vouched for: 8.4** (likely 7.3 to 9.3)
  - Claude Opus 5.5 (8.0): State of JS tracks it among testing tools, and a talk on the 2025 survey called it the de facto standard for network mocking. Independent comparisons favour it for frontend and full-stack work. The Vitest docs recommend it for request mocking, and Storybook has a widely used addon for it. Exact survey satisfaction numbers were not available to me.
  - GPT-6.2 Sol (8.7): GitLab uses MSW in its frontend integration tests, Redux and Vitest recommend it, and Storybook documents an addon built around it. State of JavaScript 2025 reports 87% satisfaction among respondents who used it. Most of that evidence applies to MSW across releases, with a shorter track record for v3 itself.
- **Safe: 7.4** (likely 6.2 to 8.5)
  - Claude Opus 5.5 (7.5): OSV lists no advisories ever, the licence is MIT, and v3 cut the dependencies to 12. Scorecard is 6.2: pinned dependencies and token permissions are strong, but code review, security policy and SAST score 0. It is mainly a dev dependency, which limits the exposure in production.
  - GPT-6.2 Sol (7.2): MSW uses the permissive MIT license, and the collected OSV data lists zero direct advisories. The GitHub Actions release workflow runs tests before publishing and enables npm provenance, while the package brings in 12 direct dependencies. The 6.2 OpenSSF Scorecard, zero code-review score, and missing published security policy leave room for improvement.

## Good

- It intercepts at the network level, so it works with fetch, axios and other clients without adapters or stubbing the client.
- The same handlers run in the browser through a Service Worker and in Node.js, including Vitest and Playwright setups.
- It covers REST, GraphQL (including subscriptions in v3) and WebSocket, with full TypeScript types.
- It is very actively maintained: 36 releases in the last year, only 14 open issues, and no known advisories.

## Bad

- v3.0 brought many breaking changes: ESM-only, Node 22+, TypeScript 5.9+ and renamed APIs.
- The maintainer no longer handles Jest/JSDOM issues, so Jest users often hit environment problems.
- Setup is heavier than Nock for simple Node-only tests, and it has no built-in recorder.
- Releases depend mostly on one lead maintainer, and the Scorecard shows no enforced code review.

## The numbers

- Downloads, 4 weeks: 135M
- In a year: ×4.7
- GitHub stars: 18k
- Commits, 12 months: 123
- Last npm release: Nov 2026
- Advisories, 24 months: 0
- Licence: MIT
- GitHub: https://github.com/mswjs/msw
- npm: https://www.npmjs.com/package/msw

Scores run from 0 to 10 and are the mean of the scores of AI reviewers (Claude Opus 5.5, GPT-6.2 Sol), made on 22 November 2026 from GitHub, npm, OSV, OpenSSF Scorecard, ecosyste.ms, Hacker News and Bluesky data and a web search. The ecosyste.ms count of repositories that use a project is far too low for projects that grew in the last few years, and some reviews quote it. Overall is the reviewers' own judgement for a new project today, not an average of the parts. An AI wrote them and can be wrong.
