Slash Command: /test-coverage
Slash Command: /test-coverage is a verified SLASH_COMMAND blueprint on Promptally in Interactive Slash Commands optimized for leading AI models. Analyze coverage, identify gaps, and generate missing tests toward the target threshold. Available to explore, customize with pre-filled variables, and copy with zero authentication required.
Technical Specifications
| Specification | Value |
|---|---|
| Artifact type | SLASH COMMAND (Interactive Slash Commands) |
| Compatible engines | Universal / Model Agnostic |
| Input variables | None (pre-filled) |
| Approximate tokens | 623 |
| Source file | test-coverage.md |
| Access tier | Free public (MIT) |
Pre-Filled Template
# 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
How to use this slash command
- Review the pre-filled example and source files above.
- Copy the template or download
test-coverage.md, then use it in your model, IDE, or workflow tool. - Compare your result with the sample output when one is provided.
Frequently Asked Questions
How do I use Slash Command: /test-coverage?
Open the slash command on Promptally, review the pre-filled example, then copy the template or download test-coverage.md and paste it into your model, IDE or workflow tool. Slash Command: /test-coverage is a static blueprint with no dynamic variables. Copy it and use it as-is.
Is Slash Command: /test-coverage free?
Yes. Slash Command: /test-coverage is free to view, copy and download on Promptally without creating an account. It is published under the MIT license.
What variables does Slash Command: /test-coverage need?
Slash Command: /test-coverage is a static blueprint with no dynamic variables. Copy it and use it as-is.