js-testing

Generates and diagnoses Vitest and Jest tests for JavaScript and TypeScript projects.

Updated Jul 6, 2026
One-click install
npx skills add https://github.com/chenziyang110/launchdeck --skill js-testing-chenziyang110
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: js-testing
Source: https://github.com/chenziyang110/launchdeck/tree/main/.claude/skills/js-testing
Command: npx skills add https://github.com/chenziyang110/launchdeck --skill js-testing-chenziyang110

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing and maintaining JavaScript/TypeScript tests is time-consuming, and teams often struggle with choosing the right mocking strategy, fixing flaky tests, and reaching meaningful coverage thresholds. ## Core Features & Use Cases - Test Generation: Produces unit, component, integration, and E2E tests using Vitest, Jest, Testing Library, MSW, and Playwright following a structured five-phase execution protocol. - Failure Diagnosis & Coverage: Guides debugging of failing or flaky tests and configures coverage thresholds with v8 reporters and CI gating. - Use Case: A developer asks for tests for a React component that fetches user data; the skill analyzes the code, selects MSW for HTTP mocking, and outputs a complete test file with run commands and a verification checklist. ## Quick Start Ask the agent to write Vitest tests for a specific JavaScript or TypeScript file in your project.

Frequently Asked Questions about js-testing

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

FAQPage Schema
How do I write Vitest tests for a TypeScript function?▼

Create a .test.ts file importing describe, it, and expect from vitest, then write assertions against the function's public API. Run tests with npx vitest run and add coverage with the --coverage flag.

How to mock HTTP requests in JavaScript tests?▼

Use MSW (Mock Service Worker) to intercept requests at the network level instead of mocking fetch directly. Define handlers with http.get, set up a server with setupServer, and start it in a Vitest setup file with server.listen().

Vitest vs Jest: which test framework should I use?▼

Vitest is preferred for new projects due to native Vite integration and faster execution, while Jest suits existing projects with a mature ecosystem. The skill defaults to Vitest but supports Jest when it is already configured.

Why are my async tests flaky and how do I fix them?▼

Flaky async tests usually come from setTimeout-based synchronization or real timers and network calls. Use waitFor from Testing Library, vi.useFakeTimers() for time-dependent code, and reset mocks with vi.clearAllMocks() in beforeEach.

When should I use Playwright instead of unit tests?▼

Use Playwright for critical end-to-end user journeys like login flows that require real browser rendering and navigation. Reserve Vitest unit and component tests for isolated logic, boundaries, and error cases.