بنقرة واحدة
coverage-gate
Enforce coverage thresholds AND test quality — coverage without behavioral assertions is meaningless.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Enforce coverage thresholds AND test quality — coverage without behavioral assertions is meaningless.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Validate test strength with mutation testing and harden weak assertions. Covers Stryker (JS/TS), mutmut (Python), go-mutesting (Go), and cargo-mutants (Rust).
Initialize workspace TDD Guardian config and enable strict hooks for test/coverage enforcement.
Produce findings-first code review with severity ordering, test-gap findings, and test-quality audit.
Build a comprehensive test matrix for changed behavior with explicit assertion strategy per case.
Global TDD governance policy. Enforces plan-first development, behavior-driven test quality, and strict completion gates.
Orchestrate strict TDD implementation across planner, implementer, test designer, coverage auditor, mutation auditor, and reviewer subagents.
| name | coverage-gate |
| description | Enforce coverage thresholds AND test quality — coverage without behavioral assertions is meaningless. |
coverageMode:"absolute" (default): Current behavior — all metrics must meet configured thresholds.
"no-decrease": Blocks only if coverage decreased from a recorded baseline.
| Scenario | absolute | no-decrease |
|---|---|---|
| Coverage 72%, threshold 100% | BLOCK | PASS (if baseline ≤ 72%) |
| Coverage dropped 72% → 70% | BLOCK | BLOCK (decreased) |
| Coverage improved 72% → 75% | BLOCK | PASS (improved) |
Default threshold policy (absolute mode): 100 for all metrics.
Coverage alone is insufficient. A test that touches every line but only asserts expect(mock).toHaveBeenCalled() provides zero regression safety.
Follow the assertion hierarchy and mock rules defined in the policy-core skill.
For each test file in the coverage report:
Count assertion types per test using the assertion hierarchy from policy-core:
Flag violations:
it() block where ALL assertions are Level 6-7it() block where Level 6-7 assertions outnumber Level 1-5 assertions by 3:1 or moreReport format:
Test Quality Summary:
✓ 45/48 tests have behavioral assertions
✗ 3 tests are wiring-only:
- docker/container.test.ts: "applies security defaults" (line 52) — mock args only
- cli/lifecycle.test.ts: "stops container" (line 48) — mock-was-called only
- docker/network.test.ts: "creates network" (line 28) — mock args only
Gate result: FAIL if any wiring-only tests exist in changed files. WARN (non-blocking) for existing wiring-only tests in unchanged files.
Scan all source files (not test files) for V8 coverage ignore comments. Flag misuse:
/* v8 ignore next */ or /* v8 ignore next N */ — silently fails on ??, ternaries, catch bodies, and short-circuit operators (&&, ||). Replace with /* v8 ignore start */ / /* v8 ignore stop */./* v8 ignore start */ / /* v8 ignore stop */ range pairs.Coverage Ignore Audit:
✗ 2 files use unreliable /* v8 ignore next N */:
- src/config.ts:42 — covers ?? expression, will silently fail
- src/handler.ts:88 — covers ternary, will silently fail
Fix: replace with /* v8 ignore start */ / /* v8 ignore stop */ range comments
| Current assertion | Add this | Example |
|---|---|---|
expect(mockCreate).toHaveBeenCalledWith(opts) | Verify return value | expect(result.id).toMatch(/^mx-/) |
expect(mockStop).toHaveBeenCalled() | Verify formatted output | expect(formatter.success).toHaveBeenCalledWith("Mecha stopped.") |
expect(mockCreate).toHaveBeenCalledWith(securityOpts) | Add integration test | const info = await inspect(container); expect(info.HostConfig.ReadonlyRootfs).toBe(true) |