Nock
HTTP mocking and expectations for testing.
- Status
- Generally available
- Last checked
- Checked · Oct 16, 2026
- License
- Open source
- Pricing
- Free tier · from $0
What it is
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.
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.
When it fits — and when it doesn’t
A good fit for
JavaScript developers who need to mock HTTP requests for testing purposes.
Teams that require isolated network dependencies in their test environments.
Look elsewhere if
Projects that do not involve HTTP request mocking or isolation.
Developers working with non-JavaScript languages without a compatible library.
Known weaknesses
Each one links to the public issue, changelog or docs page it came from, where we have one.
- 01
Steep learning curve for non-JavaScript developers
Nock's API and patterns are deeply integrated with JavaScript/Node.js, making it challenging for developers unfamiliar with these ecosystems.
- 02
Limited support for complex scenarios outside HTTP requests
While Nock excels at mocking HTTP requests, it lacks robust support for more complex testing scenarios such as WebSocket interactions or custom protocol handling.
- 03
Debugging can be difficult due to limited error messages
Nock's error messages and logging capabilities are sometimes insufficient, making it hard to diagnose issues when tests fail unexpectedly.
- 04
Potential performance overhead in large-scale testing environments
Extensive use of Nock for mocking can introduce performance bottlenecks, especially in scenarios with a high volume of HTTP requests.
What it does well
Intercepts and mocks HTTP requests for testing purposes.
Supports complex request matching with custom matchers.
Provides detailed logging of intercepted requests.
Pricing
- Free tier
- YesOpen source — free to use
- Paid from
- $0
- Model
- Flat rate
- Enterprise plan
- No
Pricing not independently confirmed — check the vendor’s page.
Performance benchmarks
How Fast Is It?
Set up Nock
Setup steps, common gotchas and what to check after 30 days.