testing-strategy-architect

Designs and implements full-stack testing strategies with Vitest, MSW, and Playwright.

1|Updated May 4, 2026
One-click install
npx skills add https://github.com/Scardubu/SwarmXQ --skill testing-strategy-architect-scardubu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-strategy-architect
Source: https://github.com/Scardubu/SwarmXQ/tree/main/.ai/skills/testing-strategy-architect
Command: npx skills add https://github.com/Scardubu/SwarmXQ --skill testing-strategy-architect-scardubu

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Setting up a coherent testing strategy for a full-stack application involves many non-obvious integration points: Vitest configuration, jsdom environment setup, MSW v2 API mocking, Server Action mocking, Playwright e2e configuration, and CI coverage enforcement. This Skill provides a complete, working protocol for every layer of the testing pyramid. ## Core Features & Use Cases - Vitest Unit and Component Testing: Configures Vitest with jsdom, React Testing Library, jest-axe accessibility checks, and v8 coverage thresholds (80% lines, 80% functions). - MSW v2 API Mocking: Sets up mock servers with request handlers, per-test handler overrides, and strict unhandled-request errors. - Server Action and E2E Testing: Mocks Prisma and auth for Next.js Server Actions, and configures Playwright for critical user journeys across desktop and mobile devices. - Use Case: A developer starting a Next.js app asks to "set up testing" and receives a complete Vitest config, MSW handlers, component test examples, Playwright e2e specs, and a GitHub Actions workflow with coverage gating. ## Quick Start Set up a complete testing strategy for my Next.js app with Vitest unit tests, MSW API mocking, and Playwright e2e tests wired into CI.

Frequently Asked Questions about testing-strategy-architect

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up Vitest for a React TypeScript project?

Install vitest, @vitejs/plugin-react, jsdom, and Testing Library packages, then create a vitest.config.ts with the jsdom environment, globals enabled, and a setupFiles entry. Add a setup file that imports jest-dom matchers and registers cleanup after each test.

How do I mock API calls in tests with MSW v2?

Define handlers using http.get and http.post from msw, returning HttpResponse.json payloads, then create a server with setupServer from msw/node. Start it in your Vitest setup file with onUnhandledRequest set to error, and override handlers per test with server.use.

How do I test Next.js Server Actions with Vitest?

Mock the database and auth modules with vi.mock before importing the action, providing mocked implementations for Prisma models and the auth function. Then call the action directly and assert on the mocked calls and returned results, including unauthenticated rejection cases.

What coverage thresholds should I set for a full-stack app?

The recommended configuration sets 80% for lines and functions and 70% for branches using the v8 coverage provider. Unit tests should target 90% or more for utilities, component tests 80% for interactive components, and e2e tests should cover only critical paths.

When should I use Playwright e2e tests instead of component tests?

Use Playwright only for critical user journeys like authentication, checkout, and core workflows, typically 10 to 20 slow high-confidence tests. Component tests with Testing Library cover interactions, error states, and accessibility much faster and should make up the bulk of the suite.