coverage-analysis

Analyze Vitest coverage across monorepo packages and generate reports.

21|2|Updated Nov 5, 2023
One-click install
npx skills add https://github.com/sgcarstrends/sgcarstrends --skill coverage-analysis
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: coverage-analysis
Source: https://github.com/sgcarstrends/sgcarstrends/tree/main/.claude/skills/coverage-analysis
Command: npx skills add https://github.com/sgcarstrends/sgcarstrends --skill coverage-analysis

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill analyzes test coverage across the monorepo using Vitest's V8 coverage provider to identify untested code paths and enforce quality gates.

Core Features & Use Cases

  • Coverage Analysis: Evaluate line, branch, function, and statement coverage across packages.
  • Thresholds & Reports: Configure thresholds and generate text/html/json reports.
  • Pre-Deployment Checks: Ensure sufficient coverage before production releases.

Quick Start

Run the workspace-wide coverage report with pnpm -r test:coverage or target a package with pnpm -F @sgcarstrends/api test:coverage.

Frequently Asked Questions about coverage-analysis

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

FAQPage Schema
How do I measure test coverage across a monorepo with Vitest?

Test coverage with Vitest analyzes line, branch, function, and statement coverage across your codebase using the V8 provider. Run pnpm -r test:coverage to generate workspace-wide reports, or target specific packages with pnpm -F @package-name test:coverage to identify untested code paths.

Can I set different coverage thresholds for different packages?

Yes, per-package thresholds let you enforce different coverage requirements across API, Web, Database, and other packages in your monorepo. Configure include/exclude patterns and threshold rules in Vitest to match each package's testing strategy and quality gates.

What coverage report formats does Vitest generate?

Vitest generates text, HTML, JSON, and LCOV coverage reports. These formats support different workflows: HTML for visual inspection, JSON for CI integration, LCOV for third-party tools, and text for command-line review.

How do I enforce coverage checks before deployment?

Pre-deployment validation uses Vitest coverage thresholds to block releases when coverage falls below configured targets. Set per-package thresholds and integrate coverage commands into your CI pipeline to prevent untested code from reaching production.

Can I use coverage analysis for code reviews?

Yes, coverage-analysis generates reports that identify untested code paths, enabling reviewers to spot gaps in test coverage during code review. Compare coverage metrics before and after changes to ensure new code maintains or improves overall quality gates.

Does coverage analysis work with pnpm monorepos?

Yes, coverage-analysis integrates with pnpm workspaces using pnpm scripts. Run workspace-wide or per-package coverage commands with -r and -F flags to analyze testing across monorepo packages and enforce thresholds consistently.