testing-expert

Diagnose and fix test structure, mocking, async, and coverage issues across Jest, Vitest, and Playwright.

3|Updated Jan 15, 2026
One-click install
npx skills add https://github.com/trudyan141/my-antigravity-agents-kit --skill testing-expert-trudyan141
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-expert
Source: https://github.com/trudyan141/my-antigravity-agents-kit/tree/main/templates/.agent/skills/testing-expert
Command: npx skills add https://github.com/trudyan141/my-antigravity-agents-kit --skill testing-expert-trudyan141

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Test suites become flaky, slow, and hard to maintain as projects grow. This Skill diagnoses testing problems across frameworks and applies proven fixes for mocking, async timing, coverage gaps, and CI inconsistencies. ## Core Features & Use Cases - Flaky Test Debugging: Detect race conditions, timing issues, and memory leaks using serial runs, fake timers, and leak detection flags. - Mock Strategy Guidance: Apply the right test double (spy, stub, mock) with proper cleanup patterns for Jest and Vitest. - Coverage & CI Optimization: Configure meaningful coverage thresholds, test sharding, parallelization, and CI/local environment parity. - Use Case: Your Playwright E2E tests pass locally but fail in CI. The Skill detects environment differences, applies retry and isolation patterns, and validates with one-shot test runs. ## Quick Start Use the testing-expert skill to find out why my Jest tests fail intermittently in CI and fix the flaky async tests.

Frequently Asked Questions about testing-expert

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

FAQPage Schema
How do I fix flaky tests in Jest or Vitest?

Run tests serially with --runInBand to expose timing issues, then add proper async/await patterns and mock timers with jest.useFakeTimers. Repeat runs multiple times and use --detectLeaks to catch memory-related intermittency.

Jest vs Vitest: which testing framework should I use?

Vitest suits new Vite-based projects with modern ESM and faster execution, while Jest fits existing setups with mature ecosystems and snapshot testing. Migration from Jest to Vitest often improves performance.

Why do my tests pass locally but fail in CI?

CI failures usually come from environment differences, race conditions, or resource limits. Standardize environment variables, run with CI=true locally, add retries for flaky tests, and use Docker containers for parity.

How do I mock modules correctly in Vitest?

Mock only external boundaries like APIs using vi.mock, and reset state with vi.clearAllMocks() in beforeEach hooks. Avoid over-mocking internal logic, which makes tests brittle and coupled to implementation.

What coverage threshold should I set for my test suite?

A common baseline is 80% for branches, functions, lines, and statements configured in jest.config.js. Focus on behavior and edge-case coverage rather than line counts, since high coverage can hide untested error paths.