Standard-driven API mocking
summary
MSW 2.0 moves API mocking onto web standards: it replaces custom handler APIs with the platform's Request/Response and leverages the service worker API for interception, unifying browser and Node (fetch, streams, headers). The rewrite throws away thousands of lines, fixes long compatibility workarounds, and keeps MSW as a reusable network layer. Adoption is concrete: more than 100,000 stars on GitHub and about 3 million weekly npm downloads, and the new API simply works with existing fetch semantics.
AI-written summary · about
chapters (6)
- 0:00API mocking introduction
- 2:29Service Worker interception
- 5:59MSW and web standards
- 8:50Node.js 18 Fetch API
- 12:40Real-world impact
- 15:28Conclusion
related talks
24mWeb APIs in Node.js Core: Past, Present, and Future
16mMastering Mocking in Playwright: Simplify API Test Automation
35mBuilding Your API for Longevity
27mAnd Now You Understand Service Workers
28mThe App-Changing Magic (and Joy) of Web APIs
44mBackend less Development revisited
26mTowards a stdlib for JavaScript Runtimes
44mWeb APIs You Should Be Using in 2026: Unlocking Next-Level Web Experiences
