For une bibliothèque de mocking pour simuler des requêtes HTTP dans les tests, the strongest matches are netflix/pollyjs (Polly), nock/nock (nock is a pioneering Node) and mswjs/msw (MSW is a dedicated HTTP request mocking library that). pgte/nock and miragejs/miragejs round out the shortlist. Each is ranked by relevance to your query, popularity and recent activity.
Outils open source pour intercepter et simuler (stub) les requêtes réseau afin de faciliter des tests unitaires et d'intégration fiables.
Pollyjs is an HTTP mocking and recording library designed to capture and replay network interactions to create deterministic tests. It functions as a request interceptor and stubbing framework that records real API responses into files, ensuring consistent test results across different environments without relying on live network servers. The tool utilizes pluggable network adapters to support various environments and employs a state-based mode switching system to toggle between recording, replaying, and stubbing behaviors. It uses pattern-based request matching and persistent interaction sto
Polly.js is an HTTP mocking library that intercepts requests, provides configurable responses via stubbing or replay from recordings, supports pattern-based request matching, integrates with test frameworks through adapters, and can pass through to real HTTP during recording mode—covering all the requested features for deterministic testing.
nock is a Node.js HTTP mocking library and request interceptor. It captures outgoing network traffic to specific hosts and paths, returning predefined responses to decouple applications from external servers during automated testing. The project functions as an API expectation framework to verify that specific calls were made with correct parameters. It includes a traffic recorder that captures real network interactions as fixtures for playback and a network simulation tool to introduce artificial latency or trigger network errors. Its capabilities cover request matching via hostnames, paths
nock is a pioneering Node.js HTTP mocking library that intercepts outgoing requests, returns configurable mock responses, supports request matching by host/path, and provides an expectation framework to assert which calls were made — it does everything this visitor needs for HTTP stub testing, missing only an explicit pass-through mode (which many real-world setups add via a separate setting).
MSW is a JavaScript API mocking library and integration testing tool designed to intercept network requests at the network level. It allows for the definition of mock data and status codes using routing syntax to simulate server responses without requiring changes to the application source code. The project utilizes a service worker to proxy API calls in the browser, providing a mechanism for isolated frontend development and testing. It employs platform-specific network adapters to maintain a consistent mocking interface across both browser and Node.js environments. The library covers a ran
MSW is a dedicated HTTP request mocking library that intercepts network requests at the network level using service workers and Node.js adapters, fully supporting configurable mock responses, request matching, test framework integration, and fallback to real HTTP, making it an ideal solution for testing code that makes HTTP requests.
Nock is a Node.js HTTP mocking library used to intercept outgoing network requests and return predefined responses. It functions as a network request interceptor and HTTP mock server, allowing developers to simulate external API behavior for automated testing without making live network calls. The project includes an API fixture recorder to capture real network interactions and save them as reusable data files for playback. It also features a network latency simulator that introduces artificial delays to outgoing HTTP responses to verify timeout handling and race conditions. The library prov
Nock is a Node.js library that intercepts outgoing HTTP requests and lets you define mock responses, with built-in request matching and assertion capabilities—exactly the kind of HTTP mocking tool this search is after.
Mirage JS is a browser-based mock server and client-side API simulator designed for JavaScript application development. It functions as a mocking tool that intercepts network requests to simulate backend API behavior, allowing developers to build and test frontend interfaces without requiring live backend infrastructure. The tool provides a simulation layer that mimics REST endpoints to facilitate rapid prototyping of user flows and application logic. It enables the creation of fake server responses directly within the web browser to verify how an application handles various data scenarios an
Mirage.js is a browser-based HTTP mocking library that intercepts network requests and returns configurable fake responses, directly matching your need to stub HTTP calls during testing; its primary focus on frontend API simulation covers interception, route matching, and test integration, though it may not include built-in pass-through to real servers or request assertion helpers.
This project is a multi-protocol API simulation and mocking system designed to replace external dependencies during development and testing. It provides an API mocking server, a network traffic proxy, and specialized simulators for language model services and identity providers. The system distinguishes itself through deep AI simulation capabilities, including the emulation of language model providers and Model Context Protocol servers using JSON-RPC 2.0. It supports multi-turn conversational logic, state tracking for AI chat APIs, and the visualization of agent execution through call graphs
MockServer intercepts HTTP requests via its proxy and server modes, offers configurable responses, request matching, pass-through proxying, and verification—so it covers all the requested features for test-time HTTP stubbing, though it is a full mocking system rather than a lightweight library.
OkHttp is an HTTP client for the JVM and Android that enables network communication via synchronous and asynchronous requests. It provides a core identity as a comprehensive networking toolkit featuring a WebSocket client for bidirectional data synchronization, a TLS security toolkit for encrypted communication, and a programmable HTTP mock server for simulating backend responses. The project distinguishes itself through a specialized security and performance architecture. It implements mutual TLS, certificate pinning, and DNS over HTTPS to secure data in transit, while utilizing connection p
OkHttp is an HTTP client for the JVM and Android that includes a built‑in programmable mock server (MockWebServer) for intercepting requests, configuring responses, and asserting on received requests during tests, which aligns with the request‑mocking library intent but may lack native pass‑through to real HTTP for unmocked requests.
Fetch-mock is a testing utility designed to isolate application code from external network dependencies by intercepting and overriding outgoing traffic. It functions as a network request interceptor that captures calls made via the Fetch API, allowing developers to simulate server responses and verify application behavior without requiring a live backend infrastructure. The library distinguishes itself through a unified interface that provides consistent network interception logic across diverse runtime environments, including browsers, service workers, and server-side platforms. By replacing
fetch-mock is a JavaScript library specifically built to intercept and stub fetch requests in tests, making it a perfect fit for your need to mock HTTP requests during testing.
This library provides a utility for intercepting and simulating HTTP requests within the Axios ecosystem. It functions as an HTTP request interceptor that allows developers to define mock responses for outgoing network traffic, enabling frontend integration testing and development without requiring live backend infrastructure. The tool distinguishes itself by offering granular control over the request lifecycle, including the ability to match specific request patterns and forward unmatched traffic to actual destinations. It supports the simulation of unstable network environments by injecting
axios-mock-adapter is a Node.js library that intercepts Axios HTTP requests in tests, allowing configurable mock responses and request matching — a straightforward fit if your codebase uses Axios.