Skip to content

/test-coverage

Analyze coverage, identify gaps, and generate missing tests toward the target threshold.

From plugin
ecc
303k113 skills71 agents113 commands1 MCP
> /plugin marketplace add affaan-m/ECC
> /plugin install ecc@ecc

Command definition

test-coverage.md
description: Analyze coverage, identify gaps, and generate missing tests toward the target threshold.

Test Coverage

Analyze test coverage, identify gaps, and generate missing tests to reach 80%+ coverage.

Step 1: Detect Test Framework

| Indicator | Coverage Command | |-----------|-----------------| | `jest.config.*` or `package.json` jest | `npx jest --coverage --coverageReporters=json-summary` | | `vitest.config.*` | `npx vitest run --coverage` | | `pytest.ini` / `pyproject.toml` pytest | `pytest --cov=src --cov-report=json` | | `Cargo.toml` | `cargo llvm-cov --json` | | `pom.xml` with JaCoCo | `mvn test jacoco:report` | | `go.mod` | `go test -coverprofile=coverage.out ./...` |

Step 2: Analyze Coverage Report

1. Run the coverage command 2. Parse the output (JSON summary or terminal output) 3. List files **below 80% coverage**, sorted worst-first 4. For each under-covered file, identify:

  • Untested functions or methods
  • Missing branch coverage (if/else, switch, error paths)
  • Dead code that inflates the denominator

Step 3: Generate Missing Tests

For each under-covered file, generate tests following this priority:

1. **Happy path** — Core functionality with valid inputs 2. **Error handling** — Invalid inputs, missing data, network failures 3. **Edge cases** — Empty arrays, null/undefined, boundary values (0, -1, MAX_INT) 4. **Branch coverage** — Each if/else, switch case, ternary

Test Generation Rules

  • Place tests adjacent to source: `foo.ts` → `foo.test.ts` (or project convention)
  • Use existing test patterns from the project (import style, assertion library, mocking approach)
  • Mock external dependencies (database, APIs, file system)
  • Each test should be independent — no shared mutable state between tests
  • Name tests descriptively: `test_create_user_with_duplicate_email_returns_409`

Step 4: Verify

1. Run the full test suite — all tests must pass 2. Re-run coverage — verify improvement 3. If still below 80%, repeat Step 3 for remaining gaps

Step 5: Report

Show before/after comparison:

Coverage Report
──────────────────────────────
File                   Before  After
src/services/auth.ts   45%     88%
src/utils/validation.ts 32%    82%
──────────────────────────────
Overall:               67%     84%  PASS:

Focus Areas

  • Functions with complex branching (high cyclomatic complexity)
  • Error handlers and catch blocks
  • Utility functions used across the codebase
  • API endpoint handlers (request → response flow)
  • Edge cases: null, undefined, empty string, empty array, zero, negative numbers
Read more
@affaan-m
Ships withecc

Your agent can write code, but ECC gives it a coordinated engineering system and toolbox: it plans before it builds, verifies changes with tests, reviews its own work from a fresh context, remembers what matters, and turns repeated wins into reusable skills

303k200 skills71 agents1 MCP
Get the whole plugin, auto-invoked

Stars on GitHub

Momentum

stars in total
302.5k
Star history of affaan-m/ECC on GitHub, a chart by star-history.com

Other commands on ecc.

aside
Auto-invoked

aside

Command

Answer a quick side question without interrupting or losing context from the current task. Resume work automatically after…

@affaan-m@affaan-mInstall Command
astra-review
Auto-invoked

astra-review

Command

Send Claude-written code to GPT-6-Astra (ChatGPT, via Codex CLI) for an independent cross-provider review, then fix what it finds.

@affaan-m@affaan-mInstall Command
auto-update
Auto-invoked

auto-update

Command

Pull the latest ECC repo changes and reinstall the current managed targets.

@affaan-m@affaan-mInstall Command

More commands from other plugins.

build
Auto-invoked

build

Command

Implement tasks incrementally — build, test, verify, commit. Add "auto" to run the whole plan in one approved pass.

@addyosmani@addyosmaniInstall Command
audit-codebase

audit-codebase

Command

RTK Codebase Health Audit — 7 catégories scorées 0-10

rtk5d86k
@rtk-ai@rtk-aiInstall Command