Test Audit + Disable
Role: worker. Identifies tests that cannot fail and disables them so the next coverage run measures a true baseline, not a false positive inflated by tautologies. Tests are skipped + tagged, never deleted — Phase 4 repairs them.
You have been invoked with the /test-audit-disable command.
Parse Arguments
Arguments: $ARGUMENTS
- Positional:
<repo-path>— the repo under modernization. --repo-slug <slug>— namespace under.claude/memory/<workflow>/. Defaults to the last path segment.--dry-run— print the cannot-fail list and exit without disabling.
Steps
1. Detect language + test framework
Probe the repo root for the test stack. Take the first match:
package.json→ JS/TS —jest,vitest,mocha,playwright. Skip helpers per framework:it.skip/test.skip/xit/xdescribe.pyproject.toml/setup.py/setup.cfg→ Python —pytest,unittest. Skip helpers:@pytest.mark.skip(reason=...),@unittest.skip(...).pom.xml/build.gradle*→ JVM —JUnit5,JUnit4,TestNG,Kotest. Skip helpers:@Disabled("..."),@Ignore("..."),@Test(enabled=false).*.csproj→ .NET —xunit,nunit,mstest. Skip:[Fact(Skip="…")],[Test, Ignore("…")].Cargo.toml→ Rust —#[ignore = "…"].go.mod→ Go —t.Skip("…").
If multiple stacks are present, process each. If none, ask the operator which to use.
2. Detect cannot-fail tests
For each test file, search for the cannot-fail patterns. The set is language-agnostic conceptually but the regex differs per framework — use these signal patterns:
| Pattern | Example | Reason |
|---|---|---|
| No assertion at all | it('does X', () => { service.doX(); }) | nothing to fail on |
| Assertion on a literal | expect(1).toBe(1), assertEquals(true, true) | self-evaluating |
| Expect-truthy on a constant | expect(true).toBeTruthy() | tautology |
| Self-equality | expect(x).toBe(x), assertEquals(obj, obj) | always true |
| Swallowed exception with no assertion in the catch | try { … } catch { } | masks failures |
| Assertion only inside a never-entered branch | if (false) { assert … } | dead test |
| expect.anything() / expect.any(*) as the only assertion | | matches anything |
| Negative assertion on a never-thrown error | expect(() => fn()).not.toThrow() with no throw path | tautology unless fn can throw |
For Python add: assert True, self.assertTrue(True), self.assertIsNotNone(self). For JVM add: assertTrue(true), assertEquals(x, x). For Go add: if err != nil { t.Errorf(…) } blocks with no error-path coverage and t.Log as the only call.
A finding requires file path + line + snippet + reason. Use Grep (ripgrep) with file globs scoped to the framework's test conventions.
Graph-assisted lookup. Prefer CodeGraph/Repowise over raw Grep for locating
test files and confirming a suspect assertion has no real call path behind it
(e.g. a swallowed-exception catch block that never reaches production error