node-fetch VS Nock

Compare node-fetch vs Nock and see what are their differences.


A light-weight module that brings the Fetch API to Node.js (by node-fetch)


HTTP server mocking and expectations library for Node.js (by nock)
Our great sponsors
  • SonarQube - Static code analysis for 29 languages.
  • OPS - Build and Run Open Source Unikernels
  • Scout APM - Less time debugging, more time building
node-fetch Nock
39 4
7,255 11,194
2.0% 1.1%
7.7 8.2
4 days ago 9 days ago
JavaScript JavaScript
MIT License MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.


Posts with mentions or reviews of node-fetch. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-01-08.


Posts with mentions or reviews of Nock. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-01-14.
  • Mocking With Undici Like a Pro
    2 projects | | 14 Jan 2022
    Because Undici re-invents HTTP primitives and relies directly on sockets, our established mocking approaches like Nock no longer work. Luckily, Undici comes with its own built-in mocks, so we can still write unit tests against it. This post goes into detail into Undici’s mocking support, walking you through specific use-cases and examples.
  • Mock server with React Native
    1 project | | 27 Sep 2021
    nock lets you mock out a domain, and then individual endpoints along with fake responses. You can then assert that all the requests were made as expected.
  • [Question] Actix-web : Testing a server route that relies on an external service
    2 projects | | 5 Apr 2021
    a big part of making rust awesome is for us as a community to massively steal ideas from other older languages. for this extremely common use case, we could benefit massively from a ripoff of nock to simply fake http responses. there is almost surely already something like this on's a good place to start.
  • API Mocking Strategies for JavaScript Applications
    5 projects | | 16 Mar 2021
    nock, through stubbing http/https modules

What are some alternatives?

When comparing node-fetch and Nock you can also consider the following projects:

axios - Promise based HTTP client for the browser and node.js

request - 🏊🏾 Simplified HTTP request client.

got - 🌐 Human-friendly and powerful HTTP request library for Node.js

superagent - Ajax for Node.js and browsers (JS HTTP client)

isomorphic-fetch - Isomorphic WHATWG Fetch API, for Node & Browserify

http-proxy - A full-featured http proxy for node.js

Express - Fast, unopinionated, minimalist web framework for node.

window.fetch polyfill - A window.fetch JavaScript polyfill.

msw - Seamless REST/GraphQL API mocking library for browser and Node.js.

nodejs-httpp - Run HTTP over UDP with Node.js