Elestia Open Source Ratings
5.7

fetch-mock

Reasonable, with limits. 7th of 10 mocking and test data.

fetch-mock is a mature, typed library that replaces the global fetch in tests so you can match requests and return fake responses. It works well for simple unit tests. For most new projects, Mock Service Worker now does the same job more realistically, and fetch-mock has had no npm release in over a year.

Best for: Teams that want light, function-level stubbing of fetch in Jest, Vitest or the browser without setting up a mock server.

WebsiteGitHubnpm

Scores

Overall5.7

How strongly do we recommend it for a new project today?

Claude Opus 5.5: 5.0, likely 4.0 to 6.0

It is a competent, well-typed fetch stubber that is fine for quick unit tests and existing suites. For a new project, MSW covers the same need at the network level, works in browser and Node, and is growing much faster. No release in over a year and a mostly single-maintainer setup add some risk.

GPT-6.2 Sol: 6.4, likely 5.3 to 7.5

fetch-mock is a reasonable choice for new fetch-only unit tests where precise matching and call assertions matter. Mock Service Worker is the stronger default when tests span multiple HTTP clients or share handlers across Node.js and browser suites. A year without a core release and below-median download growth lower confidence in fetch-mock as a long-term choice.

Needed by many5.3

How many developers need a tool for this job?

Claude Opus 5.5: 5.0, likely 4.0 to 6.0

Many front-end and Node developers need to mock HTTP calls in tests. This tool covers only the fetch-based part of that need. It does not cover function stubs or test data, which other tools in the category handle.

GPT-6.2 Sol: 5.5, likely 4.4 to 6.6

Stubbing API calls is a common need in web and Node.js tests, and fetch-mock works across multiple runtimes and test runners. Its focus on fetch limits its audience within a category that also covers other HTTP clients, function mocks, and test data. Survey data shows that developers struggle with mocking, but the share that needs a dedicated fetch stub is unclear.

Helps a lot6.8

How well does it do the job for those who need it?

Claude Opus 5.5: 6.0, likely 5.0 to 7.0

The v12 rewrite gives a clean API, good matchers, types and test-runner wrappers. The 2025 releases fixed abort and body-handling bugs. Because it mocks the fetch function rather than the network, it is less realistic than MSW for integration tests, and MSW handlers can also be reused in development.

GPT-6.2 Sol: 7.5, likely 6.4 to 8.5

Version 12.6.0 covers detailed request matching, custom responses, and filterable call history, with built-in types and a short quickstart. Its versioned examples give coding agents a clear setup pattern, though older examples use the removed `.mock()` API. A reported request-body edge case shows where the stub can diverge from native fetch. Independent performance measurements and direct evaluations of coding agents are scarce.

Holds up over time5.3

Will it still be a good choice in two years?

Claude Opus 5.5: 5.0, likely 3.0 to 6.0

The repository is active, with 82 commits in the last year, a push in November 2026, only 4 open issues and automated releases. But there have been no npm releases since October 2025, and mostly one maintainer carries the project. The ecosystem is moving towards network-level mocking with MSW.

  • github commitsLastYear / releasesLastYear: 82 commits but 0 releases in the last year.
  • github openIssues: 4 open issues and 405 closed, so issues are handled.
  • pkgpulse.com/guides/best-api-mocking-libraries-2026: Recommends MSW for nearly all new projects.
  • maintainer: Mostly maintained by Rhys Evans alone.

GPT-6.2 Sol: 5.5, likely 4.2 to 6.8

The repository recorded 82 commits in a year, and the maintainer responded to a request-body report within three days. The core package has gone more than a year without a release, while MSW and Nock both shipped this month. Version 12 required test rewrites even with a codemod. npm lists one collaborator, and ongoing funding and backup publish access are unclear.

Used widely5.0

How many use it, and is that growing?

Claude Opus 5.5: 5.0, likely 4.0 to 6.0

It has about 6.2M downloads in 4 weeks and 14.5k dependent repositories, which is solid use. Its growth ratio is 1.44, far below the 4.1 median, while MSW grew about 4.7x, so it is losing share. Many of these installs are likely long-standing test suites rather than new choices.

  • npm downloadsLast4Weeks / downloadsSame4WeeksYearAgo: 6.17M vs 4.28M, a ratio of 1.44 against a median of 4.1.
  • dependents.repos: 14,474 repositories, more than MSW's count in the bundle.
  • bluesky posts / hackerNews stories: Zero posts and zero stories: little current attention.

GPT-6.2 Sol: 4.9, likely 3.8 to 6.0

ecosyste.ms found 14,474 dependent repositories and 2,142 packages, with more indexed repositories than MSW and far fewer than Nock. Four-week downloads rose 44% to 6.17 million, but the 1.44× ratio trailed the catalog median of 4.1× and MSW's 4.68×. Legacy v9 installs, wrapper dependencies, and stars shared with the monorepo make fresh adoption harder to estimate. The bundle recorded no matched Hacker News stories or Bluesky links for fetch-mock.

Vouched for4.4

Who stands behind it being good?

Claude Opus 5.5: 4.0, likely 3.0 to 5.0

It is long established and comparison sites suggest it for simple fetch mocking. But current independent guides and well-known voices recommend MSW instead. No survey data or prominent production endorsements turned up.

GPT-6.2 Sol: 4.7, likely 3.4 to 6.0

Apollo Client lists v9 as a test dependency, and a Vue team reports using fetch-mock at work. Instructure migrated 90 Canvas test files to MSW, which Vitest also recommends for request mocking. Firsthand reports support practical use, while current v12 endorsements and direct satisfaction data are sparse.

Safe6.8

How safe is it to depend on?

Claude Opus 5.5: 7.0, likely 6.0 to 8.0

It has no advisories ever, only 4 dependencies, an MIT licence and automated releases from CI. The Scorecard is a middling 5.8, with weak token permissions, branch protection and security policy checks. As a dev-only dependency, its risk is low.

  • advisories.total: 0 advisories.
  • scorecard: 5.8 overall; Token-Permissions, Branch-Protection and Security-Policy score 0.
  • npm dependencies: 4 dependencies.
  • github.com/wheresrhys/fetch-mock/releases: Releases are published by GitHub Actions.

GPT-6.2 Sol: 6.6, likely 5.5 to 7.7

The MIT-licensed package has four direct dependencies and zero recorded OSV advisories. OpenSSF gives code review full marks, while branch protection, workflow token permissions, and security policy each score zero. The v12.6.0 configuration gates publishing on tests and authenticates to npm with a stored token, and npm lists one collaborator. The advisory record gives little evidence about how quickly a future fix would ship.

Good

  • Its route matchers are rich: URL, method, headers, body, query and, since v12.6, host.
  • It runs in Node and the browser with no service worker or build setup, and ships its own TypeScript types.
  • Official @fetch-mock/jest and @fetch-mock/vitest wrappers add call assertions that fit each test runner.
  • It has a small footprint: 4 dependencies, MIT licence and no known advisories.

Bad

  • It patches fetch itself, so tests can miss real request problems such as wrong headers. Network-level tools like MSW catch these.
  • The last release was v12.6.0 in October 2025, and mostly one maintainer drives the project.
  • Downloads grew far slower than the median, so its share of new projects is falling.
  • It only covers fetch: code that uses axios, node:http or GraphQL clients needs another tool.

The numbers

npm downloads, 4 weeks
6.2M +44% in a year
GitHub stars
1.3k
Commits, 12 months
82
npm version
12.6.0 Oct 2025
Versions, 12 months
0
Advisories, 24 months
0 of 0 ever
OpenSSF Scorecard
5.8 out of 10, Oct 2026
Licence
MIT

Read on 21 November 2026 from GitHub (wheresrhys/fetch-mock), npm (fetch-mock), OSV and the OpenSSF Scorecard.

Mocking and test data

  1. 8.5Mock Service Worker
  2. 8.1Faker
  3. 7.1Nock
  4. 6.9Mockttp
  5. 6.9Sinon.JS
  6. 6.5Fishery
  7. 5.7fetch-mock
  8. 5.6JSON Server
  9. 5.4testdouble.js
  10. 4.1Mirage JS
Compare all 10 on six scores