Nock
HTTP mocking and expectations for testing.
Pricing
Free tier
Flat rate
Adoption
→StableLicense
Open Source
Data freshness
Aging · Jun 8, 2026Overview
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
Honest assessment
Strengths & Weaknesses
↑ Strengths
↓ Weaknesses
Nock's API and patterns are deeply integrated with JavaScript/Node.js, making it challenging for developers unfamiliar with these ecosystems.
While Nock excels at mocking HTTP requests, it lacks robust support for more complex testing scenarios such as WebSocket interactions or custom protocol handling.
Nock's error messages and logging capabilities are sometimes insufficient, making it hard to diagnose issues when tests fail unexpectedly.
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
Integrations
Next step
Get Started with Nock
Step-by-step setup guide with code examples and common gotchas.