awesome-repositories.com
Blog
MCP
awesome-repositories.com

Discover the best open-source repositories with AI-powered search.

ExploreCurated searchesOpen-source alternativesSelf-hosted softwareBlogSitemap
ProjectMCP serverAboutHow we rankPress
LegalPrivacyTerms
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
wheresrhys avatar

wheresrhys/fetch-mock

0
View on GitHub↗
1,310 stars·192 forks·JavaScript·MIT·22 viewswww.wheresrhys.co.uk/fetch-mock↗

Fetch Mock

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 the native fetch function with a proxy, it enables the definition of custom response payloads, status codes, and headers, while simultaneously maintaining a log of all intercepted requests for post-execution verification.

The tool supports a range of testing methodologies, including frontend unit testing and API integration testing. It provides a matching engine to evaluate outgoing requests against user-defined predicates and includes capabilities for asserting that specific requests were executed with the expected parameters, methods, and headers.

Features

  • API Request Mocking - Intercepts Fetch API requests to simulate server responses and verify application behavior without a live backend.
  • Network Request Interceptors - Captures and overrides HTTP traffic to ensure test suites remain fast, deterministic, and independent of live servers.
  • API Integration Testing - Validates application behavior by simulating specific HTTP server responses and error conditions during integration tests.
  • Request Verification - Asserts that applications trigger expected HTTP requests with correct parameters, methods, and headers during automated tests.
  • Frontend Unit Testing - Enables frontend unit testing by intercepting network calls to isolate components from backend dependencies.
  • Request Matching Engines - Evaluates outgoing requests against user-defined predicates to select the appropriate mock response.
  • Environment Abstraction Layers - Decouples network interception logic from specific runtime environments like browsers, Node.js, and service workers.
  • Cross-Environment Test Harnesses - Ensures consistent network interception behavior across diverse runtime environments including browsers and server-side platforms.
  • Request Interception Middleware - Processes outgoing requests through a chain of handlers to determine whether to return a mock or proceed.
  • Response Mocking - Allows configuration of custom response bodies, status codes, and headers to simulate various server outcomes.
  • Network Request Histories - Maintains a detailed log of all intercepted network requests to enable post-execution verification and assertions.
  • Cross-Environment Test Execution - Provides a consistent testing harness for network interception across browser and server-side JavaScript runtimes.
  • Global Object Interception - Intercepts network calls by replacing the global fetch function with a proxy handler.
  • JavaScript Testing Frameworks - Provides a library for isolating code from network dependencies during automated JavaScript test execution.
  • Response Simulators - Provides asynchronous promise-based responses with custom headers and bodies to simulate network behavior during tests.
  • Network Request Assertions - Validates application logic by asserting that specific network requests were made with the expected parameters and headers.
  • Network Request Interception - Prevents actual network traffic during testing by capturing fetch calls and returning predefined responses.

Star history

Star history chart for wheresrhys/fetch-mockStar history chart for wheresrhys/fetch-mock

How this analysis was created: This summary and feature list are AI-generated from collected project material and can contain mistakes. Stars, license and language are imported from GitHub. Inclusion does not mean that we have tested or audited this project. Check the source documentation for any feature you depend on. Learn more on our About page.

AI search

Explore more awesome repositories

Describe what you need in plain English — the AI ranks thousands of curated open-source projects by relevance.

Start searching with AI

Frequently asked questions

What does wheresrhys/fetch-mock do?

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.

What are the main features of wheresrhys/fetch-mock?

The main features of wheresrhys/fetch-mock are: API Request Mocking, Network Request Interceptors, API Integration Testing, Request Verification, Frontend Unit Testing, Request Matching Engines, Environment Abstraction Layers, Cross-Environment Test Harnesses.

Which projects share features with wheresrhys/fetch-mock?

Projects with overlapping indexed features include: getsentry/responses — Responses is a Python mocking library designed to intercept outgoing HTTP calls made with the Requests library to… nock/nock — nock is a Node.js HTTP mocking library and request interceptor. It captures outgoing network traffic to specific hosts… pgte/nock — Nock is a Node.js HTTP mocking library used to intercept outgoing network requests and return predefined responses. It… square/okhttp — OkHttp is an HTTP client for the JVM and Android that enables network communication via synchronous and asynchronous… ctimmerm/axios-mock-adapter — This library provides a utility for intercepting and simulating HTTP requests within the Axios ecosystem. It functions… bblimke/webmock — WebMock is a Ruby library for HTTP request stubbing, response simulation, and network interception. It serves as a…

Projects sharing features with Fetch Mock

These projects share indexed features with Fetch Mock. Shared tags can include platform or build tooling; verify the primary use case before treating a result as a replacement.
  • getsentry/responsesgetsentry avatar

    getsentry/responses

    4,350View on GitHub↗

    Responses is a Python mocking library designed to intercept outgoing HTTP calls made with the Requests library to return predefined simulated responses. It functions as a request verification framework and a network simulation tool, allowing for the verification of application behavior against various API response patterns without making real network calls. The project distinguishes itself through a traffic recorder that captures real network interactions and saves them to files for deterministic replay. It further enables the simulation of complex network scenarios, including the triggering

    Pythontag-production
    View on GitHub↗4,350
  • nock/nocknock avatar

    nock/nock

    13,103View on GitHub↗

    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

    JavaScripthttpjavascriptmock
    View on GitHub↗13,103
  • pgte/nockpgte avatar

    pgte/nock

    13,108View on GitHub↗

    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

    JavaScript
    View on GitHub↗13,108
  • square/okhttpsquare avatar

    square/okhttp

    46,971View on GitHub↗

    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

    Kotlinandroidgraalvmjava
    View on GitHub↗46,971
  • Compare all 30 related projects→

    Curated searches featuring Fetch Mock

    Hand-picked collections where Fetch Mock appears.
    • HTTP Request Mocking Libraries