smithery.ai

setup-frontend-testing

Configures the frontend testing stack for a React/Vite project (Vitest, RTL, MSW). for E2E setup, use 'setup-e2e-testing'.

First seen Mar 21, 2026

Installation

$ npx skills add https://smithery.ai

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery.ai · top by installs.

npx skills add https://smithery.ai

Browse all from smithery.ai

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,044 B
  • docs SUMMARY.md 152 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 1 installs

SKILL.md

Setup Frontend Testing (Unit/Integration)

Procedure

1. Install Dependencies

Install the required dev-dependencies ensuring compatibility with React 18+ and Vite.

npm install -D vitest jsdom @testing-library/react @testing-library/user-event @testing-library/jest-dom @vitest/coverage-v8 msw

2. Configure Vitest (vitest.config.ts)

Create or update the config to use jsdom and set coverage thresholds:

  • Globals: true
  • Environment: jsdom
  • Setup Files: src/test/setup.ts
  • Coverage:

Lines: 85% Branches: 75%

3. Setup Global Test Environment (src/test/setup.ts)

  1. Import @testing-library/jest-dom.
  2. Configure MSW Server lifecycle (beforeAll(listen), afterEach(reset), afterAll(close)).
  3. Mock global browser APIs not present in JSDOM (e.g., ResizeObserver, matchMedia).

4. Scaffold Folder Structure

Create the following structure to support Co-located Unit tests:

src/
├── features/
│   └── [feature]/
│       ├── components/
│       │   └── [Component].test.tsx  # Unit/Component Tests
│       └── api/
│           └── mswHandlers.ts        # Network Mocks for this feature
├── test/
│   ├── setup.ts                      # Global setup
│   └── utils.tsx                     # Custom render wrapper

5. Create Custom Render Wrapper

In src/test/utils.tsx, export a render function that wraps components in:

  • QueryClientProvider (retry: false)
  • MemoryRouter
  • HelmetProvider (if used)

6. Verification

  1. Run npm run test to verify Vitest & MSW are active.

Constraints

  • E2E Separation: Do NOT put Playwright tests here. Use the testing-e2e-with-playwright skill for E2E.
  • MSW Modularization: Ensure handlers are modular (per feature), not one giant file.