Purpose
A test that cannot fail is a false coverage claim: it reports green whatever the code does. This
skill runs a deterministic script detector over the suite. It does not execute tests or judge
membership; it reports every test the rules catch, with a coverage denominator.
A second layer reads the runner config: a suite whose runner swallows a failure cannot fail
whatever its bodies assert, so the detector reports that shape under the same rule ids, gate and
findings file, with its own denominator of configs enumerated. It reads the Playwright config and,
for rule-flaky-passes-suite alone, the retry settings of pytest (pytest-rerunfailures), Vitest
and Jest.
Boundaries, each an incumbent this skill does not duplicate:
mutation-testing:auditproves dynamically that tests miss change: it executes mutants,
costs real runtime, and judges survivors. This skill is the cheap static complement: AST-level
detection of tests that cannot fail by construction.
check-discriminating-test-skips.sh(this marketplace repo's own CI gate) owns the fourth
can't-fail shape, a skip vacating the only discriminating assertion of a case group, for bash
*.test.sh. That rule is absent here: this skill owns assertions in those files, and its
bash-harness findings are advisory (never gating --check without --strict).
- The repair queue is out of scope: findings propose an assertion (repair, not pruning:
deleting a useless test removes the false claim and the coverage together); applying repairs
belongs to the remediation lanes.
Rules
Rule ids are the qualified detector-findings form; thresholds are fixed per rule, and every finding
states the fired condition in the run's own values.
| Rule id | Detects | Tier | Confidence | Gates --check | Gates --check --strict |
|---|---|---|---|---|---|
| testing/audit/rule-zero-assertion | a runnable test body with no assertion token | IMPORTANT | high | yes | yes |
| testing/audit/rule-recomputed-expectation | an equality whose actual and expected sides are the identical expression; a deliberate determinism check f(x) == f(x) still fires and is marked cant-fail-ok: determinism contract | IMPORTANT | high | yes | yes |
| testing/audit/rule-mock-only-oracle | a mock-constructing test whose every assertion is a mock-interaction assertion | IMPORTANT | omitted | no | yes |
| testing/audit/rule-flaky-passes-suite | a runner set to retry a failing test with nothing that fails the run on a retry-earned pass, so a test passing on a retry leaves the run green: a Playwright config with retries and failOnFlakyTests absent or literal false; a pytest config with --reruns, --force-reruns or reruns and no --fail-on-flaky in addopts; a Vitest config with retry (or retry.count) under a test key; a Jest jest.retryTimes(n) call. A literal 0 never fires | IMPORTANT | omitted | no | yes |
| testing/audit/rule-only-not-forbidden | a Playwright config with forbidOnly absent or literal false, so a committed test.only shrinks the suite to one test | IMPORTANT | omitted | no | yes |
| testing/audit/rule-inert-assertion | an assertion that never evaluates: an unawaited async matcher, a Python tuple assert or mock attribute, a bare .Should();, a constant C# oracle (Assert.True(true), Assert.NotNull(typeof(T)), or Equal, NotEqual or Same on two typeof operands, which can also be a constant fail), a bats run nothing checks | IMPORTANT | high | yes | yes |
| testing/audit/rule-constant-restatement | a constant, or a literal the test bound, compared to a literal with no call before it | SUGGESTION | omitted | report-only | report-only |
| testing/audit/rule-source-text-read | a tracked non-test source file read by a static path and searched as text | SUGGESTION | omitted | report-only | report-only |
| testing/audit/rule-conditional-assertion | every assertion inside an if, a catch or a loop over a computed result, with no else and no length check; in C#, a bare return; before every assertion (one inside a catch ... when (...) guard is left alone) | IMPORTANT | omitted | yes | yes |
| testing/audit/rule-recomputed-derived | an expected value rebuilt from the call's own arguments with an operator or aggregate (reduce, sum(, a + b); a property test (a marker such as fc.assert(, @given( or Prop.ForAll in its body or its decorator or attribute stack) and Playwright are exempt, while an example test in the same file is still judged | SUGGESTION | omitted | report-only | report-only |
| testing/audit/rule-snapshot-only | every assertion is a snapshot call ("snapshot is the only oracle: review it as code"); an image comparison never counts | SUGGESTION | omitted | report-only | report-only |
| testing/audit/rule-weak-oracle | every assertion is a weak matcher (toBeDefined, is not None, Assert.NotNull) or an over-broad exception check (toThrow(), pytest.raises(Exception)) | SUGGESTION | omitted | report-only | report-only |
| testing/audit/rule-throw-only-oracle | every assertion checks only that a value the test built with new exists or has its own type (Assert.NotNull(widget), Assert.IsType<Widget>(widget)), so only a throwing constructor fails the test; C# only | SUGGESTION | omitted | report-only | report-only |
Tiercomes from each rule's row in the detector-findings severity crosswalk (the contract
cited under Persisting findings): IMPORTANT for rules whose test cannot fail on the path they
flag, SUGGESTION for the six whose test can fail (change detectors, derived expectations,
snapshots, weak oracles, throw-only oracles). Each mapping's argument lives in the crosswalk row;
the rule-keyed lookup forbids a per-finding tier choice.
- **The six report-only rules print, count and persist, and never gate
--check,--strict
included**, until a precision run shows them free of false positives. The coverage block and the
--check note count them apart.
mock-only-oracleomitsConfidenceand is advisory by default. The match is certain; its
defect-hood is not. Deliberate interaction-style (London-school) tests are the known benign case.
Per the detector-findings contract the field is high or omitted, never low.
- The two config rules omit
Confidenceand are advisory for the same reason. The read is
mechanical; defect-hood is the team's policy call. Each decline names the evidence it required and
is counted; a config whose object literal the engine cannot anchor is enumerated and not examined.
- Detection bias: every heuristic errs toward not firing. Assertion tokens match generously (a
helper named assertValidSum or checkInvariant counts), strings/comments are masked first,
skipped tests are not judged. A test that calls a function defined in the same file, bare or on
self/this/cls, whose own body asserts, throws or rejects is not a zero-assertion finding
(a method call resolves to the test's own class when it defines the name), nor is one whose
helper calls such a function, to any depth. A bats test whose last line is a standalone ! cmd
asserts through it. A missed defect costs one finding; a false positive costs the detector its
audience.
Running the detector
bash "${CLAUDE_PLUGIN_ROOT}/skills/audit/scripts/cant-fail-scan.sh" # report + denominator
bash "${CLAUDE_PLUGIN_ROOT}/skills/audit/scripts/cant-fail-scan.sh" --check # gate: exit 1 findings, 2 gap, 0 clean
bash "${CLAUDE_PLUGIN_ROOT}/skills/audit/scripts/cant-fail-scan.sh" --findings # findings file on stdout
bash "${CLAUDE_PLUGIN_ROOT}/skills/audit/scripts/cant-fail-scan.sh" --file <path> # one test file, any mode above
Scan root: the current repo's git toplevel, or $CANT_FAIL_SCAN_ROOT to narrow or point it (a
supported operator lever). A whole-tree scan runs the per-file engine on every core, or on
$CANT_FAIL_SCAN_JOBS files at a time, with the serial run's output. Ecosystems, each defined by an
adapter file in adapters/ (format): JS/TS (*.test.*/*.spec.*: Jest, Vitest, node:test, Playwright),
Python (test_*.py/*_test.py: pytest, unittest), C# (*Test.cs/*Tests.cs, Reqnroll
*StepDefinitions.cs with each [Then] step judged as a test, UnitTest*.cs, and any other
*.cs file holding a test attribute such as [Fact]: xUnit, NUnit, MSTest), Bash (*.test.sh
harnesses, *.bats), PowerShell (*.Tests.ps1, Pester) and Go (*_test.go).
Forward a --file <path> argument to the script's --file mode: it scans that one file, and its
coverage block's adapter: line names the claiming adapter, or adapter: none (...) with the
reason. /mutation-testing:audit --exercised (if enabled) reads that line to tell a test file from a source
file.
Present the script's findings and coverage block as reported. A run that examined 0 test files
says so and is never presented as a clean bill.
Over several repositories
With no target form, the scan covers the repository above, as it always has. A target form
(--repo, --repos-from, --owner, --fleet, --skip, or the same request in words) selects
several repositories, which resolve, count, fan out and merge as