Mock Service Worker
Integration library
Open Source
API mocking with Service Workers for browser and Node
Supported languages:
javascript typescript
Integrates with:
jest vitest cypress storybook
Pros and Cons
Ventajas
- + Intercepts at network level
- + Same mock for browser and Node
- + No app code modification
- + Reusable handlers
- + Excellent developer experience
Desventajas
- - Service Worker overhead in browser
- - Requires understanding request flow
- - Initial setup can be confusing
Casos de Uso
- API mocking in tests
- Development without backend
- Error handling testing
- Storybook API mocking