
Working with JavaScript and need a reliable way to mock fetch() for testing in Node.js? Mentoss is a intuitive MockServer + FetchMocker API makes intercepting and simulating network calls a breeze—ideal for developers, QA engineers, and automation testers focused on robust testing and seamless integration.
🔑 Key Features
- Cross-Environment Fetch Mocking: Works across browser, Node.js, Deno, and Bun by providing a global
fetch()mocker that intercepts and routes requests transparently. - Simple & Expressive API: Define routes elegantly and pair it with
FetchMockerto access or override global fetch—making it intuitive and powerful. - Single‑Use Route Support: Mock sequential calls by defining multiple identical routes, enabling precise control over response order (e.g., GET → DELETE → GET).
- Advanced Matching & Rich Responses: Match by URL, headers, and payload. Return varied status codes, JSON/XML/buffer bodies, or custom headers. The flexibility is perfect for complex scenarios.
- Call Verification Helpers: Use
mocker.called(url)andmocker.allRoutesCalled()to assert whether your code triggered the expected calls, essential for testing side effects.
🚀 Why You Will Love Mentoss:
- No Real Network Calls: Eliminates flakiness from external APIs and improves test speed.
- Portable Test Suites: Runs seamlessly across JavaScript environments: front-end, back-end, and edge runtimes.
- Realistic Scenarios: Single-use mock routes allow accurate simulation of multi-step flows.
- Better Assertions: Built-in call-tracking simplifies detection of missing or extra fetches.
- Streamlined Debugging: Clear mock definitions and centralized route management aid in debugging and maintenance.
Mentoss delivers a developer-friendly, feature-rich fetch mocking solution that strengthens your test reliability, maintainability, and clarity. It’s modern, well-maintained, and built with real-world scenarios in mind.
Tags:
NetworkService Virtualization


