Skip to content

ivstudio/mock-service-worker

Repository files navigation

API Mocking in JavaScript using Mock Service Worker

This repository showcases a Mock Service Worker (MSW) v2 setup in a React environment, seamlessly integrated with Jest and React Testing Library. The configuration allows MSW to intercept API calls during development and unit testing, offering comprehensive control and flexibility throughout the development process.

View the project

Key Features

  • Detailed article providing a step-by-step explanation of the implementation process.
  • Configuration of handlers, setupWorker, and setupServer for API mocking.
  • On-demand API interception during development using MSW's browser integration.
  • API interception in Jest and React Testing Library environments using MSW's Node.js integration.

Tech Stack

Getting Started

  1. Clone the repository
  2. Install dependencies: npm install
  3. Run the mock API: npm run dev:mock
  4. Start the development server: npm run dev

Testing

To run all tests, use the following command: npm run test

About

API Mocking in JavaScript using Mock Service Worker (MSW) demo.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •