diff --git a/plugins/axiomcode/skills/axiomcode/scripts/axiomcode-impact b/plugins/axiomcode/skills/axiomcode/scripts/axiomcode-impact index 1a3acbe37..b43006537 100755 --- a/plugins/axiomcode/skills/axiomcode/scripts/axiomcode-impact +++ b/plugins/axiomcode/skills/axiomcode/scripts/axiomcode-impact @@ -2297,7 +2297,10 @@ def main(argv): # (a [test] entry point, a test row) but that the count does not credit -- a runner entry this tool does not # collect (a custom test attribute, a script's main), a remote hop the test walk does not take -- made "tests: 0" # sit under a [test] row. They are named here, and `next:` counts them as tests to run. - test_rows = sorted(({m for m, _ in ent if _is_t(m)} | {c for c, role, why, cert, loc, n in D if _is_t(c) and cert != 'alongside'}) - set(tests), + # A test that only stubs it on a mock, or reaches it only through a type it holds as one, is not one of them: it is + # the [stubs it] line below, which says it is not counted because a body change cannot fail it. + test_rows = sorted(({m for m, _ in ent if _is_t(m)} | {c for c, role, why, cert, loc, n in D if _is_t(c) and cert not in ('alongside', 'stubs it') + and not why.startswith('stubs a method of this name')}) - set(tests) - set(stubbed), key=lambda m: (g.disp(m), g.loc(m))) if test_rows: print(f" {'and ' if tests else 'but '}{len(test_rows)} callable(s) in test code listed above reach it by a route this count does not credit " diff --git a/tests/cases/csharp/mock-stub-is-not-a-test-route/case.json b/tests/cases/csharp/mock-stub-is-not-a-test-route/case.json index 127aef5bc..05ccdb04b 100644 --- a/tests/cases/csharp/mock-stub-is-not-a-test-route/case.json +++ b/tests/cases/csharp/mock-stub-is-not-a-test-route/case.json @@ -20,7 +20,8 @@ "[fixture]", "MoqStubTests::", "[by name] 1 test", - "[by name] 2 test" + "[by name] 2 test", + "callable(s) in test code listed above reach it" ] }, { @@ -32,6 +33,9 @@ ], "want": [ "SnapshotTests::VerifiesASnapshot" + ], + "avoid": [ + "callable(s) in test code listed above reach it" ] }, { @@ -55,6 +59,9 @@ "want": [ "only stub it on a mock", "[resolved] Checkout.Total" + ], + "avoid": [ + "callable(s) in test code listed above reach it" ] } ] diff --git a/tests/cases/java/mock-stub-is-not-a-test-route/case.json b/tests/cases/java/mock-stub-is-not-a-test-route/case.json index c5f7fecb2..a5678ad4f 100644 --- a/tests/cases/java/mock-stub-is-not-a-test-route/case.json +++ b/tests/cases/java/mock-stub-is-not-a-test-route/case.json @@ -22,7 +22,8 @@ "avoid": [ "[sound] 3", "[sound] 4", - "[fixture]" + "[fixture]", + "callable(s) in test code listed above reach it" ] }, { @@ -47,6 +48,9 @@ "want": [ "only stub it on a mock", "[resolved] Checkout.total" + ], + "avoid": [ + "callable(s) in test code listed above reach it" ] }, {