Intercept requests at the network layer so your app code never knows it is mocked.
MSW intercepts requests using a Service Worker in the browser and a request interceptor in Node, so the same handlers serve your unit tests, component tests, E2E tests and local development. Because the interception happens below fetch, application code needs no dependency injection or mock-aware branching.
Best for
Free and open source
Open sourceFree tier: Everything, self-hosted
What drives the bill: Free and open source. You pay in engineering time and CI minutes.
Check current pricing on OSS community’s siteFigures are indicative and were last reviewed August 2026. Vendors change pricing often; confirm before you commit.
No reviews of Mock Service Worker yet. If you have used it in anger, yours would be the first.
If Mock Service Worker is not the right fit, these solve the same problem differently.
Test Data & Mocks
The standard HTTP mock server for JVM and beyond: record, replay, stub, simulate faults.
Test Data & Mocks
Spin up a realistic mock API from a desktop app in under a minute.
Test Data & Mocks
Turn an OpenAPI document into a mock server that validates as well as responds.