Mock Service Worker
mswjs.io
Spec sheet
- What it does
- MSW is an API mocking library for browser and Node.js that intercepts outgoing requests so they can be observed and answered with mocked responses.Read 30 Sep 2026 · mswjs.io
- Purpose
- Mock Service Worker (MSW) is an API mocking library for browser and Node.js that intercepts outgoing requests so developers can observe and respond with mocked responses.Read 30 Sep 2026 · mswjs.io
- Support
- The quick start directs users to a debugging runbook, MSW Discord, and GitHub Discussions for help.Read 30 Sep 2026 · mswjs.io
- Additional integrations
- The MSW organization lists extensions for Playwright, Storybook, Cloudflare workerd, and SvelteKit.Read 30 Sep 2026 · github.com
- Browser integration
- In browsers, MSW uses the Service Worker API to intercept requests at the network level.Read 30 Sep 2026 · mswjs.io
- Browser limitation
- Because browser interception relies on the Service Worker API, browser-specific limitations apply; the docs also state that Firefox does not notify the worker about page XMLHttpRequest requests.Read 30 Sep 2026 · mswjs.io
- Client compatibility
- The documentation names native fetch and third-party clients including Axios, React Query, and Apollo as supported request clients.Read 30 Sep 2026 · mswjs.io
- Learning resources
- The documentation says its official Egghead courses require a paid subscription and help support the project.Read 30 Sep 2026 · mswjs.io
- Limitations
- MSW's GraphQL documentation says it supports queries and mutations, while subscriptions are described as coming in the future.Read 30 Sep 2026 · mswjs.io
- Network APIs
- MSW supports mocking REST, GraphQL, Server-Sent Events, and WebSocket APIs.Read 30 Sep 2026 · mswjs.io
- Network standards
- MSW uses the Fetch API to handle intercepted requests and construct mocked responses, including requests made with other clients.Read 30 Sep 2026 · mswjs.io
- Node integration
- In Node.js, MSW intercepts raw socket connections before they reach the network code written in C.Read 30 Sep 2026 · mswjs.io
- Node.js integration
- In Node.js, MSW provides setupServer for enabling API mocking in an application process or test runner.Read 30 Sep 2026 · mswjs.io
- Node.js limitation
- MSW cannot intercept requests made directly through net.connect() or net.createConnection(), which some libraries use.Read 30 Sep 2026 · mswjs.io
- Open source
- The project describes MSW as open-source and free to try.Read 30 Sep 2026 · mswjs.io
- Paid learning
- The documentation says its official Egghead courses require a paid subscription.Read 30 Sep 2026 · mswjs.io
- Protocols
- MSW supports mocking HTTP, GraphQL, Server-Sent Events, and WebSocket APIs.Read 30 Sep 2026 · mswjs.io
- Request clients
- MSW works with native fetch and third-party clients such as Axios, React Query, and Apollo.Read 30 Sep 2026 · mswjs.io
- Reusable mocks
- The same mock handlers can be reused for development, integration and end-to-end testing, Storybook, and live demos.Read 30 Sep 2026 · mswjs.io
- Shared mocks
- The same client-agnostic mocks can be reused across frameworks, tools, and environments, including development, integration and end-to-end testing, Storybook, and live demos.Read 30 Sep 2026 · mswjs.io
- Tool integrations
- The site provides integration guides for Cloudflare, React Native, Storybook, Vite, and Vitest, as well as browser and Node.js.Read 30 Sep 2026 · mswjs.io
Where Specifiction places it
- API Mocking Tools#21 of 267.1