Nock

HTTP mocking and expectations for testing.

EstablishedOpen SourceLow lock-in

Pricing

Free tier

Flat rate

Adoption

Stable

License

Open Source

Data freshness

Aging · Jun 8, 2026

Overview

What is Nock?

Nock is an HTTP mocking library that allows developers to intercept and mock HTTP requests in their tests. It's essential for isolating network dependencies during unit and integration testing, ensuring reliable test results.

Key differentiator

Nock is the go-to tool for JavaScript developers needing to mock and intercept HTTP requests in their tests, providing detailed control over network interactions during testing phases.

Capability profile

Capability Radar

Ease of StartEcosystemValueMaturityFlexibilityScale Ready

Honest assessment

Strengths & Weaknesses

↑ Strengths

Intercepts and mocks HTTP requests for testing purposes.medium

Supports complex request matching with custom matchers.medium

Provides detailed logging of intercepted requests.medium

↓ Weaknesses

Steep learning curve for non-JavaScript developershigh

Nock's API and patterns are deeply integrated with JavaScript/Node.js, making it challenging for developers unfamiliar with these ecosystems.

Limited support for complex scenarios outside HTTP requestsmedium

While Nock excels at mocking HTTP requests, it lacks robust support for more complex testing scenarios such as WebSocket interactions or custom protocol handling.

Debugging can be difficult due to limited error messageshigh

Nock's error messages and logging capabilities are sometimes insufficient, making it hard to diagnose issues when tests fail unexpectedly.

Potential performance overhead in large-scale testing environmentsmedium

Extensive use of Nock for mocking can introduce performance bottlenecks, especially in scenarios with a high volume of HTTP requests.

Fit analysis

Who is it for?

✓ Best for

JavaScript developers who need to mock HTTP requests for testing purposes.

Teams that require isolated network dependencies in their test environments.

✕ Not a fit for

Projects that do not involve HTTP request mocking or isolation.

Developers working with non-JavaScript languages without a compatible library.

Cost structure

Pricing

Free Tier

Available

Open source — free to use

Starts at

$0

Model

Flat rate

Enterprise

None

Performance benchmarks

How Fast Is It?

Ecosystem

Relationships

Next step

Get Started with Nock

Step-by-step setup guide with code examples and common gotchas.

View Setup Guide →