gitwtfhub

wtf is nock?

salmanm/nock — explained in plain English

Analysis updated 2026-07-18 · repo last pushed 2020-01-08

JavaScriptAudience · developerComplexity · 2/5DormantSetup · easy

TL;DR

Nock lets Node.js developers test code that makes HTTP requests by intercepting those calls and returning fake responses instead of hitting real servers.

Mindmap

mindmap
  root((repo))
    What it does
      Intercepts HTTP calls
      Returns fake responses
      No real network calls
    Tech stack
      JavaScript
      Node.js
    Use cases
      Test API integrations
      Simulate error responses
      Avoid rate limits
    Audience
      Node.js developers
      Test engineers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Test code that calls external APIs (GitHub, Amazon, weather services) without making real network requests.

REASON 2

Simulate error responses like a 500 status to test how your code handles failures.

REASON 3

Run tests reliably without depending on internet access or third-party service uptime.

REASON 4

Verify that your code called the expected endpoints with the right parameters.

What's in the stack?

JavaScriptNode.js

How it stacks up

salmanm/nock3rd-eden/ircb.ioa15n/a15n
LanguageJavaScriptJavaScriptJavaScript
Last pushed2020-01-082016-11-162019-04-07
MaintenanceDormantDormantDormant
Setup difficultyeasyeasyeasy
Complexity2/52/52/5
Audiencedeveloperdevelopergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 30min

Yoink these prompts

Prompt 1
Show me how to use nock to mock a GET request to an external API in my Node.js test.
Prompt 2
Write a nock test that simulates a 500 error response from an API my code calls.
Prompt 3
Use nock to verify my code sent the correct headers and query parameters in a request.
Prompt 4
Explain how nock intercepts Node's built-in HTTP system to fake responses.

Frequently asked questions

wtf is nock?

Nock lets Node.js developers test code that makes HTTP requests by intercepting those calls and returning fake responses instead of hitting real servers.

What language is nock written in?

Mainly JavaScript. The stack also includes JavaScript, Node.js.

Is nock actively maintained?

Dormant — no commits in 2+ years (last push 2020-01-08).

How hard is nock to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is nock for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.