fetch-mock logo

fetch-mock

Library for mocking calls to fetch in Node.js and browsers, supporting complex matchers, named routes and global/sandbox modes.

-

Our Verdict

Pragmatic fetch mocker that is fine until you outgrow it and want MSW-level fidelity.

Pros

  • Mocks fetch in Node and browsers with one API
  • Rich matchers, named routes and sandbox mode
  • Works with Jest, Vitest, Mocha, Karma
  • Easy restore semantics per test

Cons

  • Another layer versus MSW service worker approach
  • Global patching can leak between tests
  • Docs structure is dense for newcomers
  • Less realistic than intercepting at network level
Best for: Node-side units that only need to stub fetch calls quickly Not for: Frontend integration tests better served by Mock Service Worker

When to Use fetch-mock

Good fit if you need

  • Mock fetch calls in Node.js and browser test suites
  • Named route matchers for complex URL pattern stubs
  • Sandbox mode for test isolation without globals
  • Simulate network errors and timeout scenarios

Lock-in Assessment

Low 5/5
Lock-in Score
5/5

fetch-mock Pricing

Pricing Model
free
Free Tier
Yes
Entry Price
Enterprise Available
No
Transparency Score

Beta — estimates may differ from actual pricing

1,000
1001K10K100K1M

Estimated Monthly Cost

$25

Estimated Annual Cost

$300

Estimates are approximate and may not reflect current pricing. Always check the official pricing page.

Project Health

C

Health Score

1.3k 194
Bus Factor

4

Last Commit

10 days

Release Freq

1d

Open Issues

13

Issue Response

N/A

License

MIT

Last checked: 2026-04-21

Community Discussion

Comments powered by Giscus (GitHub Discussions). You need a GitHub account to comment.