DevXTools
NO

Nock

MIT

HTTP server mocking and expectations library for Node.js. Intercepts requests at the Node.js HTTP module level, perfect for unit testing external API calls.

Overview

HTTP server mocking and expectations library for Node.js. Intercepts requests at the Node.js HTTP module level, perfect for unit testing external API calls.

When to use it

When you need straightforward HTTP mocking in Node.js with minimal setup and a clear, chainable API.

nock.back records HTTP in Node tests; for record/replay for a whole backend service, including databases, that's a different layer.

Details

Languages & Runtimes

JavaScriptTypeScript
Node.js

Categories

HTTP Interception

Best For

HTTP mocking and expectations in Node.js tests

README badges

If your tool is listed on devxtools.dev, you can add a badge to your README or docs that links to your listing. It's optional, it's free, and nobody will chase you about it.

What the badge means

The badge says your tool is listed in the devxtools.dev catalog and that we've reviewed the listing against official sources, with a dated check. That's all it means.

It doesn't mean that we endorse or recommend the tool over alternatives, that anyone paid for the listing (nobody can), or that the tool won a comparison.

Small · Light theme
Listed on devxtools.dev
Small · Dark theme
Listed on devxtools.dev
Large · Light theme
Listed on devxtools.dev
Large · Dark theme
Listed on devxtools.dev
Markdown
[![Listed on devxtools.dev](https://devxtools.dev/badge/nock.svg)](https://devxtools.dev/tools/nock/)
HTML
<a href="https://devxtools.dev/tools/nock/"><img src="https://devxtools.dev/badge/nock.svg" alt="Listed on devxtools.dev" height="20"></a>

Usage rules

  1. Only for listed tools. Use the badge only if your tool has a live listing at the URL it links to.
  2. Link to your listing. Keep the link pointing at your devxtools.dev listing page, not the home page or somewhere else.
  3. Don't modify it. Don't change the badge's wording, colours or logo.
  4. It's optional, and it has no effect. Adding the badge, or not adding it, doesn't affect your listing, its position, or any comparison or verdict.

Featured in guides