msw-fetch-mock

Community

Mock APIs in Vitest with MSW v2.

Authorrecca0120
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill solves flaky, slow, and hard-to-control frontend tests by letting you mock HTTP requests deterministically instead of relying on real network services.

Core Features & Use Cases

  • API mocking with MSW v2 in Vitest: Define request handlers using http and return typed HttpResponse objects for JSON and other payload types.
  • Per-test overrides: Use server.use(...) to customize handlers for a single test while server.resetHandlers() clears overrides automatically.
  • Network error simulation: Trigger realistic failure modes (for example HttpResponse.error()) to validate error UI and retry logic.

Quick Start

Configure your MSW handlers and server for Vitest, then run your component or integration tests while the mocked endpoints respond with the data you specified.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: msw-fetch-mock
Download link: https://github.com/recca0120/code-quest/archive/main.zip#msw-fetch-mock

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.