# nock/nock

HTTP server mocking and expectations library for Node.js

Repository: https://github.com/nock/nock
Canonical: https://ross.abutalabs.com/products/nock
Language: JavaScript
License: MIT
License Family: permissive
Topics: http, mock, nock, node, javascript
Last push: 2026-08-05T01:00:55+00:00

## Health v2 (maintenance only)
Score: 96/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 96, release rhythm 95, longevity 100
- inputs: {"age_days": 5459, "days_push": 29, "days_rel": 34, "gap_med": 14.0, "n_releases_24m": 19}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 13121, forks 764 (observed 2026-08-28T04:11:02.224301+00:00)

## What it is
Nock is an HTTP server mocking and expectations library for Node.js. It intercepts HTTP requests made by code under test and returns predefined responses, enabling isolated testing of modules that perform HTTP requests.

## Use cases
- mock HTTP requests in Node.js unit tests
- test a module that calls a third-party API in isolation
- simulate API error responses and delays in tests
- assert that expected HTTP requests were made
- test code that talks to CouchDB or AWS without hitting real services

## When to choose
- you write Node.js tests for code that makes HTTP requests
- you need deterministic, offline tests without real network calls
- you want to assert request counts, headers, bodies, and query strings

## When to avoid
- you are testing in a browser environment rather than Node.js
- you need to mock non-HTTP protocols like gRPC or WebSockets
- you want end-to-end tests against a real or containerized server

## Facets
- artifact type: library
- maturity: stable
- function: mocking, testing, http-client
- domain: testing, developer-tools, apis, web-development
- platform: -
- tags: http-mocking, unit-testing, request-interception, test-isolation, nodejs, javascript

## Member repositories
- nock/nock (main) score 96

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:11:02.224301+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:13:30.970771+00:00, confidence not recorded.
  - readme: https://github.com/nock/nock (fetched 2026-08-28T04:11:02.224301+00:00, sha dbcf63f42830)
- Data as of 2026-08-30T08:39:29.467469+00:00.
