mswjs / examples

Examples of Mock Service Worker usage with various frameworks and libraries.

Home Page:https://mswjs.io/examples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Examples

A collection of usage examples of Mock Service Worker.

JavaScript frameworks

  • Angular (Jest, Cypress)
  • Next.js
  • React Native
  • Remix (Playwright)
  • SolidJS
  • Svelte (Vitest, Playwright)
  • Vue (Vitest, Cypress)

Test frameworks

Other tools

  • Storybook

Reading examples

Each example is a standalone repository featuring the usage of MSW with a certain framework or tool. Follow the instructions written in the README.md of respective examples to integrate MSW with those particular technologies. Some examples have separate instructions for client-side and server-side integrations. You can choose either or both, depending on where you wish to gain control over the network with MSW. We highly recommend implementing both client-side and server-side interception to guarantee seamless development and testing experience.

Cloning examples

Each example can be forked immediately with CodeSandbox. To do so, click on the "Edit on CodeSandbox" button in the README.md of the respective example. This will load it in the cloud, allowing you to experiment with the integration and create reproduction cases easier.

Edit in CodeSandbox example

About

Examples of Mock Service Worker usage with various frameworks and libraries.

https://mswjs.io/examples