msw

Installation
SKILL.md

MSW (Mock Service Worker)

IMPORTANT: Your training data about msw may be outdated or incorrect — MSW v2 completely removed the rest namespace, res(ctx.*) response composition, and (req, res, ctx) resolver signature. Always rely on this skill's rule files and the project's actual source code as the source of truth. Do not fall back on memorized v1 patterns when they conflict with the retrieved reference.

When to Use MSW

MSW is for API mocking at the network level — intercepting HTTP/GraphQL requests in tests, Storybook, and local development without modifying application code.

Need Recommended Tool
Test API integration (React, Vue, Node) MSW
Storybook API mocking MSW (browser worker)
Local development without backend MSW (browser worker)
Unit testing pure functions Plain test doubles
E2E testing real APIs Playwright/Cypress network interception
Mocking module internals vi.mock() / jest.mock()

Quick Reference — v2 Essentials

Installs
29
GitHub Stars
1
First Seen
Feb 23, 2026