Add the SurveyJS white-label form builder to your JavaScript app (React/Angular/Vue3). Build complex JSON forms without coding. Fully customizable, works with any backend, perfect for data-heavy apps. Learn more. Learn more →
Nock Alternatives
Similar projects and alternatives to Nock
-
-
Civic Auth
Auth in Less Than 5 Minutes. Civic Auth comes with multiple SSO options, optional embedded wallets, and user management — all implemented with just a few lines of code. Start building today.
-
-
-
telescope
A tool for tracking blogs in orbit around Seneca's open source involvement (by Seneca-CDOT)
-
-
-
-
SurveyJS
JavaScript Form Builder with No-Code UI & Built-In JSON Schema Editor. Add the SurveyJS white-label form builder to your JavaScript app (React/Angular/Vue3). Build complex JSON forms without coding. Fully customizable, works with any backend, perfect for data-heavy apps. Learn more.
-
mockoon
Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.
-
apollo-client
:rocket: A fully-featured, production ready caching GraphQL client for every UI framework and GraphQL server.
-
-
vcr
Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
-
-
superagent
Ajax for Node.js and browsers (JS HTTP client). Maintained for @forwardemail, @ladjs, @spamscanner, @breejs, @cabinjs, and @lassjs.
-
pact-js
JS version of Pact. Pact is a contract testing framework for HTTP APIs and non-HTTP asynchronous messaging systems.
-
-
-
-
-
-
InfluxDB
InfluxDB – Built for High-Performance Time Series Workloads. InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.
Nock discussion
Nock reviews and mentions
-
The best way for testing outbound API calls
mocha is a lib inspired by nock and WireMock. It allows checking if the mock was called or not, which is a nice feature. Like httptest, it also it don't automatically intercept the requests.
- Testando chamadas para APIs da melhor forma
-
Engage Users Instantly: Embed an Interactive Demo in your React SPA
I used mock-apollo-client; for REST or tRPC, you might use something like nock. They're meant for automated testing but are exactly what we need here.
-
Effective Strategies for Writing Unit Tests with External Dependencies like Databases and APIs
For testing third-party API calls, you can use libraries such as WireMock or Nock. These tools allow you to simulate HTTP requests and responses, helping you test how your application behaves when interacting with an external service. For example, you can mock successful responses, simulate errors, or test timeouts, all without making real HTTP requests.
-
Learning from My Own Tests
My program uses the OpenAI client to interface with various LLMs, including OpenRouter, Groq, and GPT. To test this functionality, we were encouraged to use an HTTP mocking library like Nock, but it made more sense to me to mock the OpenAI client in Jest using jest.mock. In order to do this, I had to move the initialization for the OpenAI client to a separate file so that the instance could be imported and mocked in tests.
-
Testing LLM Applications: Misadventures in Mocking SDKs vs Direct HTTP Requests
As I tried to add more comprehensive tests, I ran into an interesting realization about how my application communicates with LLMs. Initially, I thought I could use Nock.js to mock the HTTP requests to these language models. After all, that's what Nock is great at - intercepting and mocking HTTP requests for testing.
-
Lab 7 - Jest Testing
I had never used Nock before this assignment, nor did I know what Nock is/was. Nock is a "server mocking and expectations library for Node.js". In this project, I used it to simulate my project connecting to the Ollama API in the test suite, where I could then test my main function without running an Ollama instance. The documentation can be found here
-
Adding Jest to dev-mate-cli
The biggest challenge was simulating AI responses from OpenAI's API. Initially, I tried using nock to intercept HTTP requests, but while researching I found that OpenAI had mocking capabilities for its constructor , which let me use captured JSON responses to simulate interactions with the model.
-
Adding Jest To Explainer.js
I'm a huge supporter for TDD(Test Driven Development). Almost every piece code should be tested. During my co-op more than half of the time I spent writing test for my PR. I believe that experience really helped me understand the necessity of testing. I was surprised to see how similar the testing framework in JS and Ruby are. I used Jest which is very similar to RSpec I have used during my co-op. To mock http resquest I used Nock kinda similar to something called VCR.
-
Testing VShell: A starting point into Test-Driven Development
Link: Nock Documentation
-
A note from our sponsor - SurveyJS
surveyjs.io | 15 May 2025
Stats
nock/nock is an open source project licensed under MIT License which is an OSI approved license.
The primary programming language of Nock is JavaScript.