Nock
Metrics as of , from the GitHub or GitLab API of each repository. Refreshed monthly.
What Nock is
Nock is a Node.js library for HTTP server mocking and expectations. Tests use it to exercise modules that make HTTP requests without reaching the real servers. It works by overriding Node's http.request function and http.ClientRequest. Tests define interceptors that match a hostname, path, method, request body, query string or headers and return a specified reply. An interceptor is removed after one use unless it is persisted or repeated. Replies can be delayed, return errors or repeat a set number of times. Helpers such as isDone and pendingMocks report mocks that were never called. A recorder captures real HTTP traffic for reuse. Nock Back records fixtures to a directory and plays them back.
Written from the project's README, read .
- Category
- Test data and mocking
- License
- MIT
- Language
- JavaScript
- Changelog
- Releases on GitHub
Repository metrics
Status
activeLast commit within 90 days of the fetch date.Computed from the last commit date and the archive flag on the fetch date. See the status rules.
Alternatives
Listed test data and mocking tools, same primary language first, then by GitHub stars. Each line gives one fact from the tool's documentation where it differs from Nock's, with its source.
JSON Server: Protocols: HTTP (REST API routes for GET, POST, PUT, PATCH, DELETE). source: README
Sinon.JS: Languages for writing tests: JavaScript. source: Docs: SinonJS home
mountebank: Languages for writing tests: REST API; community client libraries for C#, Clojure, Go, Java, JavaScript, PHP, Python, Ruby and others. source: Docs: Client Libraries
Faker: Languages for writing tests: Python (3.8 and above). source: README
Mock Service Worker: Languages for writing tests: JavaScript. source: README
@faker-js/faker: Languages for writing tests: JavaScript (browser and Node.js). source: Docs: Getting Started
Mockito: Languages for writing tests: Java. source: README
Bogus: Languages for writing tests: C#, F#, VB.NET. source: README
How to install
npm install --save-dev nockQuestions
Is Nock open source?
Yes. Nock is released under MIT, an OSI-approved license, as reported by the GitHub API on 2026-09-22.
Is Nock maintained?
On 2026-09-22, the last commit to the default branch was on 2026-07-30, so the listed status is active. Rule: Last commit within 90 days of the fetch date.
How many GitHub stars does Nock have?
13,126 stars on 2026-09-22, from the GitHub API. The number is refreshed at each monthly update.
What language is Nock written in?
The repository's primary language, as reported by the GitHub API, is JavaScript.
How do I install Nock?
The README gives this command: npm install --save-dev nock
Sources
- GitHub REST API: repository, read
- GitHub REST API: commits, read
- GitHub REST API: latest release, read
- GitHub REST API: contributors, read
- README, read