Mock Service Worker

API mocking at the network level for browser and Node.js

Visit mswjs.io FreeOpen source

Mock Service Worker (MSW) intercepts outgoing requests at the network level and returns mocked responses, using a Service Worker in the browser and request interception in Node.js. The same REST, GraphQL, and WebSocket handlers can be reused across unit tests, end-to-end tests, Storybook, and local development.

Key features

  • Network-level request interception
  • REST, GraphQL, and WebSocket handlers
  • Same mocks in browser and Node.js
  • Framework- and client-agnostic

Try it on DevTools Daily

Similar tools

  • Vitest

    Next-generation testing framework powered by Vite

    FreeOpen sourceCLI, VS Code
  • Jest

    Delightful JavaScript testing framework with a focus on simplicity

    FreeOpen sourceCLI, VS Code
  • Testing Library

    Test UI components the way users interact with them

    FreeOpen sourceCLI
  • Cypress

    JavaScript end-to-end and component testing that runs in the browser

    by Cypress.ioFreemiumOpen sourceCLI, macOS, Windows +1
  • Faker

    Generate massive amounts of realistic fake data for testing and development

    FreeOpen sourceCLI, Web
  • Grafana k6

    Developer-centric load testing with tests written in JavaScript

    by Grafana LabsFreemiumOpen sourceCLI, macOS, Windows +1

Built a tool like Mock Service Worker? Submit it for review