Nock

HTTP server mocking and expectations library for Node.js (by nock)

Nock Alternatives

Similar projects and alternatives to Nock

  1. jest

    520 Nock VS jest

    Delightful JavaScript Testing.

  2. Civic Auth

    Auth in Less Than 5 Minutes. Civic Auth comes with multiple SSO options, optional embedded wallets, and user management — all implemented with just a few lines of code. Start building today.

    Civic Auth logo
  3. axios

    480 Nock VS axios

    Promise based HTTP client for the browser and node.js

  4. public-apis

    413 Nock VS public-apis

    A collective list of free APIs

  5. telescope

    335 Nock VS telescope

    A tool for tracking blogs in orbit around Seneca's open source involvement (by Seneca-CDOT)

  6. react-router

    185 Nock VS react-router

    Declarative routing for React

  7. msw

    165 Nock VS msw

    Industry standard API mocking for JavaScript.

  8. mocha

    167 Nock VS mocha

    ☕️ simple, flexible, fun javascript test framework for node.js & the browser

  9. SurveyJS

    JavaScript Form Builder with No-Code UI & Built-In JSON Schema Editor. Add the SurveyJS white-label form builder to your JavaScript app (React/Angular/Vue3). Build complex JSON forms without coding. Fully customizable, works with any backend, perfect for data-heavy apps. Learn more.

    SurveyJS logo
  10. mockoon

    55 Nock VS mockoon

    Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.

  11. apollo-client

    30 Nock VS apollo-client

    :rocket:  A fully-featured, production ready caching GraphQL client for every UI framework and GraphQL server.

  12. Karate

    28 Nock VS Karate

    Test Automation Made Simple

  13. vcr

    25 Nock VS vcr

    Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.

  14. WireMock

    24 Nock VS WireMock

    A tool for mocking HTTP services

  15. superagent

    17 Nock VS superagent

    Ajax for Node.js and browsers (JS HTTP client). Maintained for @forwardemail, @ladjs, @spamscanner, @breejs, @cabinjs, and @lassjs.

  16. pact-js

    19 Nock VS pact-js

    JS version of Pact. Pact is a contract testing framework for HTTP APIs and non-HTTP asynchronous messaging systems.

  17. miragejs

    17 Nock VS miragejs

    A client-side server to build, test and share your JavaScript app

  18. gock

    12 Nock VS gock

    HTTP traffic mocking and testing made easy in Go ༼ʘ̚ل͜ʘ̚༽

  19. http-proxy

    14 Nock VS http-proxy

    A full-featured http proxy for node.js

  20. node-fetch

    93 Nock VS node-fetch

    A light-weight module that brings the Fetch API to Node.js

  21. window.fetch polyfill

    25 Nock VS window.fetch polyfill

    A window.fetch JavaScript polyfill.

  22. InfluxDB

    InfluxDB – Built for High-Performance Time Series Workloads. InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a better Nock alternative or higher similarity.

Nock discussion

Log in or Post with

Nock reviews and mentions

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 2025-02-06.
  • The best way for testing outbound API calls
    6 projects | dev.to | 6 Feb 2025
    mocha is a lib inspired by nock and WireMock. It allows checking if the mock was called or not, which is a nice feature. Like httptest, it also it don't automatically intercept the requests.
  • Testando chamadas para APIs da melhor forma
    7 projects | dev.to | 6 Feb 2025
  • Engage Users Instantly: Embed an Interactive Demo in your React SPA
    5 projects | dev.to | 9 Jan 2025
    I used mock-apollo-client; for REST or tRPC, you might use something like nock. They're meant for automated testing but are exactly what we need here.
  • Effective Strategies for Writing Unit Tests with External Dependencies like Databases and APIs
    6 projects | dev.to | 14 Nov 2024
    For testing third-party API calls, you can use libraries such as WireMock or Nock. These tools allow you to simulate HTTP requests and responses, helping you test how your application behaves when interacting with an external service. For example, you can mock successful responses, simulate errors, or test timeouts, all without making real HTTP requests.
  • Learning from My Own Tests
    4 projects | dev.to | 11 Nov 2024
    My program uses the OpenAI client to interface with various LLMs, including OpenRouter, Groq, and GPT. To test this functionality, we were encouraged to use an HTTP mocking library like Nock, but it made more sense to me to mock the OpenAI client in Jest using jest.mock. In order to do this, I had to move the initialization for the OpenAI client to a separate file so that the instance could be imported and mocked in tests.
  • Testing LLM Applications: Misadventures in Mocking SDKs vs Direct HTTP Requests
    2 projects | dev.to | 10 Nov 2024
    As I tried to add more comprehensive tests, I ran into an interesting realization about how my application communicates with LLMs. Initially, I thought I could use Nock.js to mock the HTTP requests to these language models. After all, that's what Nock is great at - intercepting and mocking HTTP requests for testing.
  • Lab 7 - Jest Testing
    2 projects | dev.to | 8 Nov 2024
    I had never used Nock before this assignment, nor did I know what Nock is/was. Nock is a "server mocking and expectations library for Node.js". In this project, I used it to simulate my project connecting to the Ollama API in the test suite, where I could then test my main function without running an Ollama instance. The documentation can be found here
  • Adding Jest to dev-mate-cli
    2 projects | dev.to | 8 Nov 2024
    The biggest challenge was simulating AI responses from OpenAI's API. Initially, I tried using nock to intercept HTTP requests, but while researching I found that OpenAI had mocking capabilities for its constructor , which let me use captured JSON responses to simulate interactions with the model.
  • Adding Jest To Explainer.js
    6 projects | dev.to | 7 Nov 2024
    I'm a huge supporter for TDD(Test Driven Development). Almost every piece code should be tested. During my co-op more than half of the time I spent writing test for my PR. I believe that experience really helped me understand the necessity of testing. I was surprised to see how similar the testing framework in JS and Ruby are. I used Jest which is very similar to RSpec I have used during my co-op. To mock http resquest I used Nock kinda similar to something called VCR.
  • Testing VShell: A starting point into Test-Driven Development
    1 project | dev.to | 6 Nov 2024
    Link: Nock Documentation
  • A note from our sponsor - SurveyJS
    surveyjs.io | 15 May 2025
    Add the SurveyJS white-label form builder to your JavaScript app (React/Angular/Vue3). Build complex JSON forms without coding. Fully customizable, works with any backend, perfect for data-heavy apps. Learn more. Learn more →

Stats

Basic Nock repo stats
33
12,917
6.3
8 days ago

nock/nock is an open source project licensed under MIT License which is an OSI approved license.

The primary programming language of Nock is JavaScript.


Sponsored
Auth in Less Than 5 Minutes
Civic Auth comes with multiple SSO options, optional embedded wallets, and user management — all implemented with just a few lines of code. Start building today.
www.civic.com

Did you know that JavaScript is
the 3rd most popular programming language
based on number of references?