Mock Service Worker
A strong pick. 1st of 10 mocking and test data.
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
Overall8.5
How strongly do we recommend it for a new project today?
Claude Opus 5.5: 8.5, likely 7.5 to 9.0
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.
- npm downloads ratio: About 4.7x against a 4.1 median, faster than Nock and Sinon.
- newreleases.io/project/github/mswjs/msw/release/v3.0.0: Fresh major release with breaking changes.
- pkgpulse.com/guides/best-api-mocking-libraries-2026: Search summary only (not opened): Nock is still widely used, mostly in older Node codebases.
GPT-6.2 Sol: 8.5, likely 7.4 to 9.4
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.
- devxtools.dev/comparisons/msw-vs-nock: Independent tests show the trade-off between shared mocks and built-in assertions.
- docs.gitlab.com/development/testing_guide/frontend_testing: Documented use in a large project's integration suite.
- mswjs.io/docs/migrations/2.x-to-3.x: Version 3 changes runtime requirements and public APIs.
- mswjs.io/sponsor: Maintenance remains concentrated despite sponsorship.
- github releasesLastYear; npm downloadsLast4Weeks, downloadsSame4WeeksYearAgo; medianDownloadsRatio: Frequent releases and download growth above the catalog median.
Needed by many6.6
How many developers need a tool for this job?
Claude Opus 5.5: 6.5, likely 5.5 to 7.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.
- category.job: The category also covers spies and test data, which MSW does not do.
- theodo.com/blog/nock-vs-msw-i-tested-both-and-here-is-what-i-learned: Rated 5/5 for versatility: Node, browser, React Native, REST and GraphQL.
- bluesky top posts: The maintainer says Jest/JSDOM issues are no longer handled.
GPT-6.2 Sol: 6.6, likely 5.5 to 7.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.
- mswjs.io/docs: Framework-agnostic interception for browsers and Node.js.
- 2024.stateofjs.com/en-US/libraries/testing: 939 of 11,667 respondents to the work-use question reported using MSW professionally.
- category job; peers: The category also covers function doubles and generated test data.
Helps a lot8.6
How well does it do the job for those who need it?
Claude Opus 5.5: 8.5, likely 7.5 to 9.0
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.
- newreleases.io/project/github/mswjs/msw/release/v3.0.0: v3 features and the long list of breaking changes.
- theodo.com/blog/nock-vs-msw-i-tested-both-and-here-is-what-i-learned: Independent test preferred MSW and noted setup cost and slight slowness.
- npm hasTypes: Ships its own TypeScript types.
GPT-6.2 Sol: 8.7, likely 7.5 to 9.5
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.
- github.com/mswjs/msw/releases/tag/v3.0.7: Confirms the current stable patch.
- mswjs.io/docs/quick-start: Current typed examples and supported protocols.
- devxtools.dev/comparisons/msw-vs-nock: Independent v3 tests cover native fetch, Axios, and request assertions.
- vitest.dev/guide/mocking/requests: The GraphQL example still imports graphql from the package root.
- mswjs.io/docs/migrations/2.x-to-3.x: Version 3 moves GraphQL to its own entry point and changes setup options.
- github.com/mswjs/msw/issues/2821: Users reproduced delayed delivery of streamed responses in Node.js on v3.
Holds up over time7.7
Will it still be a good choice in two years?
Claude Opus 5.5: 8.0, likely 7.0 to 9.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).
- github releasesLastYear / openIssues: 36 releases, 14 open issues against 1,269 closed.
- scorecard Maintained: Scores 10.
- newreleases.io/project/github/mswjs/msw/release/v3.0.0: Many breaking changes in v3.
- MSW funding: Funded through Open Collective and GitHub Sponsors, with one main maintainer.
GPT-6.2 Sol: 7.3, likely 5.9 to 8.6
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.
- github commitsLastYear, releasesLastYear; peers: 123 commits and 36 releases, compared with 32 commits for Nock.
- github.com/mswjs/msw/releases/tag/v3.0.6: November patch fixes optional path handling.
- opencollective.com/mswjs: November funding from the Vite Ecosystem Fund and Vitest.
- mswjs.io/sponsor: The lead maintainer reports that funding falls short of supporting a team.
- mswjs.io/docs/migrations/2.x-to-3.x: Documents breaking changes and links to migration codemods.
- github.com/mswjs/msw/issues/2698: Jest users reported startup failures after upgrading.
Used widely7.6
How many use it, and is that growing?
Claude Opus 5.5: 8.5, likely 7.5 to 9.0
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.
- npm downloadsLast4Weeks / downloadsSame4WeeksYearAgo: 134.7M against 28.8M, a ratio of about 4.7.
- dependents: 11,851 repos and 2,234 packages.
- github stars: 18.4k stars, second in the category after JSON Server.
- bluesky posts: 53 posts, far more than any peer (6 or fewer).
GPT-6.2 Sol: 6.7, likely 5.3 to 8.0
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.
- npm downloadsLast4Weeks, downloadsSame4WeeksYearAgo; medianDownloadsRatio; peers: 134.7 million versus 28.8 million installs, yielding the highest peer growth ratio.
- dependents repos, packages; peers dependentRepos: 11,851 indexed repos and 2,234 packages versus 130,286 indexed repos for Nock.
- github stars; bluesky posts, top; peers: 18,356 stars and 53 Bluesky links, compared with at most six links per peer.
- npmjs.com/package/msw?activeTab=versions: Several v2 releases individually outdraw the most downloaded v3 release.
Vouched for8.4
Who stands behind it being good?
Claude Opus 5.5: 8.0, likely 7.0 to 9.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.
- gitnation.com/contents/the-2025-state-of-javascript-testing: Survey talk calls MSW the de facto standard for network mocking.
- 2025.stateofjs.com/en-US/libraries/testing: Listed among tracked testing tools.
- theodo.com/blog/nock-vs-msw-i-tested-both-and-here-is-what-i-learned: Independent agency write-up picks MSW.
- Vitest docs 'Mocking Requests': Vitest recommends MSW for network mocking.
GPT-6.2 Sol: 8.7, likely 7.6 to 9.6
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.
- docs.gitlab.com/development/testing_guide/frontend_testing: GitLab uses MSW to serve fixtures in its Vue integration suite.
- github.com/reduxjs/redux/blob/master/docs/usage/WritingTests.mdx: Redux recommends it for integration testing.
- vitest.dev/guide/mocking/requests: Vitest recommends MSW for request mocking.
- storybook.js.org/docs/writing-stories/mocking-data-and-modules/mocking-network-requests: Storybook documents the MSW addon.
- 2025.stateofjs.com/en-US/libraries: 87% satisfaction in the library tier list.
Safe7.4
How safe is it to depend on?
Claude Opus 5.5: 7.5, likely 6.5 to 8.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.
- advisories total: 0 advisories.
- scorecard: 6.2 overall; Code-Review, Security-Policy and SAST score 0.
- npm dependencies: 12 dependencies.
- npm license: MIT.
GPT-6.2 Sol: 7.2, likely 5.9 to 8.5
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.
- advisories total, last24Months; npm license, dependencies: Zero recorded advisories, MIT license, and 12 direct dependencies.
- scorecard score, checks: 6.2 overall, with strong dependency pinning and token permissions but zero for code review and security policy.
- github.com/mswjs/msw/blob/v3.0.7/.github/workflows/release.yml: Automated release job depends on the test and build job.
- raw.githubusercontent.com/mswjs/msw/v3.0.7/release.config.json: Publishing configuration enables npm provenance.
- github.com/mswjs/msw/security: GitHub shows no published security policy.
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
- npm downloads, 4 weeks
- 135M ×4.7 in a year
- GitHub stars
- 18k
- Commits, 12 months
- 123
- npm version
- 3.0.7 Nov 2026
- Versions, 12 months
- 36
- Advisories, 24 months
- 0 of 0 ever
- OpenSSF Scorecard
- 6.2 out of 10, Nov 2026
- Licence
- MIT
Read on 21 November 2026 from GitHub (mswjs/msw), npm (msw), OSV and the OpenSSF Scorecard.
Mocking and test data
- 8.5Mock Service Worker
- 8.1Faker
- 7.1Nock
- 6.9Mockttp
- 6.9Sinon.JS
- 6.5Fishery
- 5.7fetch-mock
- 5.6JSON Server
- 5.4testdouble.js
- 4.1Mirage JS