Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

feat(health): measure mock saturation on TypeScript, and refuse Java (#2358)

Raghav Chamadiyae4ffd6c71bbb
diff --git a/docs/layers/CODE_HEALTH.md b/docs/layers/CODE_HEALTH.md
index a91a69aba..32553c99d 100644
--- a/docs/layers/CODE_HEALTH.md
+++ b/docs/layers/CODE_HEALTH.md
@@ -433,18 +433,20 @@ make a review verdict blocking.
| Marker | Languages | What it measures |
|---|---|---|
-| `mock_saturated_test` | Python | Mock-setup statements per assertion in a test function |
+| `mock_saturated_test` | Python · TypeScript / JavaScript | Mock-setup statements per assertion in a test function |
A marker earns weight by clearing the house precision bar (roughly 70%
-hand-labelled) on a real corpus. `mock_saturated_test` has not: a 32-finding
-hand-labelled sample scored 44% at its loosest useful gate and 67% at the gate it
-ships with. It stays advisory until two false-positive families are separated:
-value-object builders named `Fake*` passed as input to real logic, and boundary
-isolation where the assertion reads a real artifact. Telling
-either from genuine saturation needs to know whether an assertion observes a
-double or production output, which is a dataflow question the pass does not ask.
-
-Per-language coverage and why Go is blocked:
+hand-labelled) on a real corpus. `mock_saturated_test` has not, and precision is
+measured per language because it does not transfer: **67%** on Python (32
+findings) and **40%** on TypeScript (30 findings), each the complete population
+at the shipped gate. It stays advisory until two false-positive families are
+separated: value-object builders named `Fake*` passed as input to real logic, and
+boundary isolation where the assertion reads a real artifact. Both turn on
+whether an assertion observes a double or production output, which is a dataflow
+question the pass does not ask — and on the TypeScript sample that one question
+accounted for every false positive.
+
+Per-language coverage and why Go and Java are blocked:
[LANGUAGE_SUPPORT.md](LANGUAGE_SUPPORT.md#code-health-coverage).
## Performance risk
diff --git a/docs/layers/LANGUAGE_SUPPORT.md b/docs/layers/LANGUAGE_SUPPORT.md
index dc7d8e915..b8a371c9a 100644
--- a/docs/layers/LANGUAGE_SUPPORT.md
+++ b/docs/layers/LANGUAGE_SUPPORT.md
@@ -358,9 +358,9 @@ map before markers fire. This table is why a language is Full rather than Good.
| Language | Complexity / nesting | Class metrics | Assertion smells | Mock saturation | Extract Method | Performance risk |
|----------|:---:|:---:|:---:|:---:|:---:|:---:|
| Python | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
-| TypeScript / JavaScript | ✅ | ✅ | ✅ | later | ✅ | ✅ |
+| TypeScript / JavaScript | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Svelte · Vue | ✅ | ✅ | ✅ | later | ✅ | ✅ |
-| Java | ✅ | ✅ | ✅ | later | ✅ | ✅ |
+| Java | ✅ | ✅ | ✅ | blocked | ✅ | ✅ |
| Go | ✅ | n/a | ✅ | blocked | ✅ | ✅ |
| Rust | ✅ | ✅ | ✅ | later | ✅ | ✅ |
| C++ | ✅ | ✅ | ✅ | later | ✅ | ✅ |
@@ -382,11 +382,35 @@ grammar**, not unscheduled.
needs both a mock vocabulary and a trustworthy assertion count. The vocabulary
is one data row per language in
`analysis/health/mocks/lexicon.py`; a language with no row produces no signal at
-all. Go is **blocked**, not unscheduled: its `assert_call_kinds` is best-effort
-for testify only, so idiomatic `t.Error` / `t.Fatal` tests are invisible to the
-shared assert/expect prefix match and every ratio computed from them would be
-wrong. Go needs its own assertion vocabulary before the marker can be honest
-there. The marker is advisory and never deducts. See
+all.
+
+Because the marker is advisory it ships below the 70% bar, so the line is not
+drawn on the precision number alone: **a language ships when its false positives
+are the families the marker already declares, and is blocked when its failure is
+a different one the marker cannot name.** TypeScript's every false positive was
+the known assertion-observes-production-output family. The two blocked languages
+fail differently, and for the same underlying reason — the assertion count is the
+denominator of every ratio, so a language whose assertions cannot be counted
+honestly cannot carry the marker at all:
+
+- **Go** — its `assert_call_kinds` is best-effort for testify only, so idiomatic
+ `t.Error` / `t.Fatal` tests are invisible to the shared assert/expect prefix
+ match. Go needs its own assertion vocabulary first.
+- **Java** — Mockito states a test's real checks as `verify(...)`, which is
+ deliberately not an assertion here (counting it would hide the very tests this
+ marker looks for). An over-mocked Java test therefore arrives with one vacuous
+ `assertDoesNotThrow` as its whole denominator, so the marker misses the tests
+ it is for and the ratio peaks instead on large controller tests whose setup is
+ irreducible fixture. Java needs a verification vocabulary of its own first.
+ Measured at 20% precision over 30 hand-labelled findings, flat across every
+ threshold tried — but the mechanism above, not that number, is why it is
+ blocked.
+
+Svelte and Vue stay `later` rather than following TypeScript: an SFC is walked as
+a TypeScript buffer, but a single-file component is essentially never a test
+file, so the row would be untestable rather than useful.
+
+The marker is advisory and never deducts. See
[CODE_HEALTH.md](CODE_HEALTH.md).
Per-marker mechanics, every per-language precision ceiling and the reasoning
diff --git a/packages/core/src/repowise/core/analysis/health/biomarkers/base.py b/packages/core/src/repowise/core/analysis/health/biomarkers/base.py
index 5a85146dd..913f5e6fa 100644
--- a/packages/core/src/repowise/core/analysis/health/biomarkers/base.py
+++ b/packages/core/src/repowise/core/analysis/health/biomarkers/base.py
@@ -29,6 +29,12 @@ class FileContext:
# Map symbol-name → complexity metrics for functions/methods in this
# file. Symbols without a complexity row default to CCN=1, nesting=0.
function_metrics: dict[str, FunctionComplexity] = field(default_factory=dict)
+ # Every walked function, in document order and NOT keyed by name, because
+ # name-keying drops all but one of a file's anonymous ``it`` callbacks.
+ # Read only by ``mock_saturated_test``, which is advisory: re-keying
+ # ``function_metrics`` is the real fix and would change what every
+ # calibrated marker sees, so it needs its own defect-corpus evidence.
+ all_functions: tuple[FunctionComplexity, ...] = ()
# Per-class aggregate metrics (LCOM4, method count, size). Empty for
# languages whose walker map doesn't opt into class-level analysis
# (see ``complexity.languages``). Consumed by ``low_cohesion`` /
diff --git a/packages/core/src/repowise/core/analysis/health/biomarkers/mock_saturated_test.py b/packages/core/src/repowise/core/analysis/health/biomarkers/mock_saturated_test.py
index acc9a2627..9f972067c 100644
--- a/packages/core/src/repowise/core/analysis/health/biomarkers/mock_saturated_test.py
+++ b/packages/core/src/repowise/core/analysis/health/biomarkers/mock_saturated_test.py
@@ -33,9 +33,11 @@ class MockSaturatedTestDetector:
name = "mock_saturated_test"
category = "test_quality"
- # Hand-labelled over 32 findings: 44% at a floor of 4, 67% at 6. Precision
- # follows the floor, not the ratio, so the floor does the work and the ratio
- # only keeps wide integration tests out. Raise them rather than lower them.
+ # Hand-labelled per language, because precision does not transfer: 67% on
+ # Python (32 findings), 40% on TypeScript (30). Precision follows the floor
+ # and not the ratio -- Python measured 44% at a floor of 4 against 67% at 6 --
+ # so the floor does the work and the ratio only keeps wide integration tests
+ # out. Raise them rather than lower them.
_MIN_MOCK_SETUP = 6
_MIN_RATIO = 3.0
_HIGH_RATIO = 8.0 # setup:assertion at which the test is nearly all scaffolding
@@ -45,7 +47,9 @@ class MockSaturatedTestDetector:
return []
prefixes = _name_prefixes(ctx.language)
out: list[BiomarkerResult] = []
- for fn in ctx.function_metrics.values():
+ # ``all_functions``, not ``function_metrics``: name-keying collapses a
+ # file's anonymous ``it`` callbacks into one row. See ``FileContext``.
+ for fn in ctx.all_functions:
mocks = fn.mock_setup_count
asserts = fn.assertion_count
# No assertion at all means a fixture or a helper, not a saturated
diff --git a/packages/core/src/repowise/core/analysis/health/complexity/mock_walk.py b/packages/core/src/repowise/core/analysis/health/complexity/mock_walk.py
index 4ffac7b37..2eee3387b 100644
--- a/packages/core/src/repowise/core/analysis/health/complexity/mock_walk.py
+++ b/packages/core/src/repowise/core/analysis/health/complexity/mock_walk.py
@@ -26,7 +26,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING
-from ..mocks.lexicon import MOCK_IDENTIFIER_TOKENS, MockDialect
+from ..mocks.lexicon import MOCK_DIALECTS, MOCK_IDENTIFIER_TOKENS, MockDialect
from .assertions import _is_assertion_statement
from .ast_utils import _IDENTIFIER_SUFFIX
from .languages import LanguageNodeMap
@@ -35,9 +35,16 @@ if TYPE_CHECKING:
from tree_sitter import Node
# Whole-file precheck, so production code pays one substring scan and nothing
-# else. Matched against a lowercased copy, so casing never matters.
+# else. Matched against a lowercased copy, so casing never matters. Built from
+# every dialect's ``file_markers`` so that adding a language stays one row.
_FILE_MARKERS: tuple[bytes, ...] = tuple(
- sorted(tok.encode() for tok in (*MOCK_IDENTIFIER_TOKENS, "patch"))
+ sorted(
+ tok.encode()
+ for tok in {
+ *MOCK_IDENTIFIER_TOKENS,
+ *(m for d in MOCK_DIALECTS.values() for m in d.file_markers),
+ }
+ )
)
@@ -166,8 +173,7 @@ def _count_decorators(fn_node: Node, lmap: LanguageNodeMap, dialect: MockDialect
``@patch("a.b")`` injects a double exactly as a ``patch(...)`` call in the
body would. Grammars that park decorators on a wrapper node declare it via
``decorated_definition_kinds``; the rest keep them inside the function node.
- The scan descends one level, since C# groups attributes under an
- ``attribute_list`` and Java annotations under ``modifiers``.
+ The scan descends one level, for grammars that group them under a wrapper.
"""
if not lmap.decorator_kinds:
return 0
diff --git a/packages/core/src/repowise/core/analysis/health/engine.py b/packages/core/src/repowise/core/analysis/health/engine.py
index 37708e07f..6e09bbf61 100644
--- a/packages/core/src/repowise/core/analysis/health/engine.py
+++ b/packages/core/src/repowise/core/analysis/health/engine.py
@@ -99,7 +99,11 @@ log = structlog.get_logger(__name__)
# Not a licence to move a calibrated scoring weight — those are frozen
# independently of this stamp.
#
-# Current stamp: ``mock_saturated_test`` landed and the walker records two new
+# Current stamp: ``mock_saturated_test`` gained a TypeScript / JavaScript
+# vocabulary, so a TS or JS file's ``mock_setup_count`` changes from the zero a
+# cached v12 walk stored for it.
+#
+# v12: ``mock_saturated_test`` landed and the walker records two new
# ``FunctionComplexity`` fields, which a cached v11 walk does not carry.
#
# v11: F# and Objective-C gained working complexity node maps and Elixir lost
@@ -122,7 +126,7 @@ log = structlog.get_logger(__name__)
# forms. Files that were counted untested and are not become tested, which
# moves untested-hotspot findings and the scores that carry them, on every
# language with a prefix or spec convention rather than Ruby alone.
-HEALTH_ANALYZER_VERSION = 12
+HEALTH_ANALYZER_VERSION = 13
# Method-level smells that make the dataflow / Extract Method pass worthwhile.
# Only files carrying one of these get a CFG + def/use + reaching pass built.
@@ -1039,9 +1043,10 @@ class HealthAnalyzer:
# exist for symbol stamping and the sql_high_complexity marker
# (maintainability). Keeping them out of function_metrics keeps the
# calibrated method biomarkers (defect dimension) from firing on SQL.
- fn_metrics: dict[str, FunctionComplexity] = (
- {} if pf.file_info.language == "sql" else {fc.name: fc for fc in fc_list}
+ fns: tuple[FunctionComplexity, ...] = (
+ () if pf.file_info.language == "sql" else tuple(fc_list)
)
+ fn_metrics: dict[str, FunctionComplexity] = {fc.name: fc for fc in fns}
max_ccn = max((fc.ccn for fc in fc_list), default=1)
max_nesting = max((fc.max_nesting for fc in fc_list), default=0)
nloc = fcx.file_nloc
@@ -1093,6 +1098,7 @@ class HealthAnalyzer:
reached_by_tests=file_path in self._files_reached_by_tests(),
module=module,
function_metrics=fn_metrics,
+ all_functions=fns,
class_metrics=fcx.classes,
git_meta=file_git_meta,
dependents_count=dependents_count,
diff --git a/packages/core/src/repowise/core/analysis/health/mocks/lexicon.py b/packages/core/src/repowise/core/analysis/health/mocks/lexicon.py
index 8b9f319d6..77c992fb6 100644
--- a/packages/core/src/repowise/core/analysis/health/mocks/lexicon.py
+++ b/packages/core/src/repowise/core/analysis/health/mocks/lexicon.py
@@ -6,8 +6,12 @@ This mirrors the per-language plugin idiom used by ``perf/dialects/`` and
``ingestion/resolvers/`` - one entry per language, registered in a dict, zero
edits to the walker to add one - but the dialect is a frozen dataclass rather
than a subclass, because every language difference here is vocabulary and none
-of it is behaviour. Adding a language is one row plus, if its grammar needs
-them, ``decorator_kinds`` / ``block_kinds`` on its ``LanguageNodeMap``.
+of it is behaviour. Adding a language is one row, plus ``block_kinds`` and
+``call_kinds`` on its ``LanguageNodeMap``. Two things a row alone will not tell
+you: ``file_markers`` must be set or the file is skipped before the walk and
+counts zero silently, and the language needs an honest ``assert_call_kinds``,
+since the assertion count is this marker's denominator. That last one is why Go
+and Java have no row.
A language absent from ``MOCK_DIALECTS`` produces no mock signal at all, which
is the safe default the precision-first house contract requires.
@@ -62,6 +66,11 @@ class MockDialect:
#: language cannot tell from the name.
test_name_prefixes: tuple[str, ...] = field(default=())
+ #: Extra lowercase substrings that mean "this file may mock", beyond
+ #: :data:`MOCK_IDENTIFIER_TOKENS`, unioned into the whole-file precheck.
+ #: Over-inclusive costs time; under-inclusive counts nothing at all.
+ file_markers: frozenset[str] = frozenset()
+
_PYTHON = MockDialect(
# ``unittest.mock`` members with no mock token in their names.
@@ -75,15 +84,81 @@ _PYTHON = MockDialect(
},
config_attributes=frozenset({"return_value", "side_effect"}),
test_name_prefixes=("test",),
+ file_markers=frozenset({"patch"}),
+)
+
+
+_JS_TS = MockDialect(
+ # Listed by receiver because each namespace mixes doubling with test-
+ # environment arrangement, the same split ``monkeypatch`` forced for Python:
+ # ``vi.fn`` installs a double, ``vi.useFakeTimers`` / ``vi.stubEnv`` arrange
+ # the run, ``vi.clearAllMocks`` tears down.
+ receiver_methods={
+ "vi": frozenset(
+ {
+ "fn",
+ "mock",
+ "domock",
+ "spyon",
+ "mocked",
+ "mockobject",
+ "hoisted",
+ "stubglobal",
+ "importmock",
+ }
+ ),
+ "jest": frozenset(
+ {
+ "fn",
+ "mock",
+ "domock",
+ "spyon",
+ "mocked",
+ "createmockfrommodule",
+ "genmockfrommodule",
+ "requiremock",
+ "replaceproperty",
+ }
+ ),
+ # ``sinon.fake.returns(...)`` reaches here as one call with ``fake`` in
+ # the receiver chain, so the configuring verbs must be listed too: an
+ # exhaustive root has no inner call to fall back on.
+ "sinon": frozenset(
+ {
+ "stub",
+ "spy",
+ "fake",
+ "mock",
+ "createstubinstance",
+ "replace",
+ "replacegetter",
+ "replacesetter",
+ "returns",
+ "resolves",
+ "rejects",
+ "throws",
+ "yields",
+ }
+ ),
+ "jasmine": frozenset({"createspy", "createspyobj"}),
+ },
+ # A JS test is an anonymous callback inside ``it(...)``, so there is no
+ # name to gate on. Empty degrades to "no extra gate", which is correct.
+ test_name_prefixes=(),
+ # ``vi.fn()`` / ``jest.fn()`` carry no test-double token anywhere in the
+ # call, so without these a file that mocks only through them is skipped.
+ file_markers=frozenset({"vi.fn", "jest.fn", "sinon", "jasmine"}),
)
# Keyed by ``LanguageTag`` (``ingestion/models.py``); one dialect may serve
-# several tags. Go stays out until it has an assertion vocabulary beyond
-# testify: its ``t.Error`` tests are invisible to the assert/expect prefix
-# match, which would make every ratio wrong.
+# several tags. Go and Java are absent deliberately: neither has a trustworthy
+# assertion count, and that is this marker's denominator. Measurements and
+# reasoning in LANGUAGE_SUPPORT.md#code-health-coverage.
MOCK_DIALECTS: dict[str, MockDialect] = {
"python": _PYTHON,
+ "javascript": _JS_TS,
+ "typescript": _JS_TS,
}
diff --git a/tests/unit/health/test_mock_saturated_test.py b/tests/unit/health/test_mock_saturated_test.py
index e44560d3b..a3f3813b5 100644
--- a/tests/unit/health/test_mock_saturated_test.py
+++ b/tests/unit/health/test_mock_saturated_test.py
@@ -17,12 +17,33 @@ from repowise.core.analysis.health.complexity.mock_walk import file_may_contain_
from repowise.core.analysis.health.models import Severity
-def _walk(source: str) -> dict[str, tuple[int, int]]:
- """``{function: (mock_setup_count, assertion_count)}`` for Python source."""
- fc = walk_file("tests/test_sample.py", "python", source.encode("utf-8"))
+def _walk(
+ source: str, path: str = "tests/test_sample.py", language: str = "python"
+) -> dict[str, tuple[int, int]]:
+ """``{function: (mock_setup_count, assertion_count)}`` for one file."""
+ fc = walk_file(path, language, source.encode("utf-8"))
return {f.name: (f.mock_setup_count, f.assertion_count) for f in fc.functions}
+def _rows(source: str, path: str, language: str) -> list[tuple[int, int]]:
+ """``(mock_setup_count, assertion_count)`` per function, in document order.
+
+ Unlike :func:`_walk`, keeps every row: a file's ``it`` callbacks all share
+ one name and a name-keyed view would collapse them.
+ """
+ fc = walk_file(path, language, source.encode("utf-8"))
+ return [(f.mock_setup_count, f.assertion_count) for f in fc.functions]
+
+
+def _require(language: str) -> None:
+ try:
+ from repowise.core.ingestion.parser import _get_language
+ except Exception:
+ pytest.skip(f"tree-sitter language pack missing for {language}")
+ if _get_language(language) is None:
+ pytest.skip(f"tree-sitter language pack missing for {language}")
+
+
def _detect(source: str, path: str = "tests/test_sample.py", language: str = "python"):
fc = walk_file(path, language, source.encode("utf-8"))
ctx = FileContext(
@@ -32,6 +53,7 @@ def _detect(source: str, path: str = "tests/test_sample.py", language: str = "py
has_test_file=True,
module=None,
function_metrics={f.name: f for f in fc.functions},
+ all_functions=tuple(fc.functions),
)
return BIOMARKER.detect(ctx)
@@ -349,25 +371,167 @@ def test_very_saturated():
def test_a_language_with_no_dialect_produces_no_signal():
- """Phase 1 is Python only; every other language must stay silent."""
- findings = _detect(
+ """A language absent from ``MOCK_DIALECTS`` stays silent.
+
+ Go is the case that matters: it is absent deliberately, not by omission,
+ because its assertion count is best-effort for testify only.
+ """
+ _require("go")
+ source = """
+func TestThing(t *testing.T) {
+ a := mockThing()
+ b := mockThing()
+ c := mockThing()
+ d := mockThing()
+ e := mockThing()
+ f := mockThing()
+ assert.NotNil(t, a)
+}
+"""
+ # Assert the walk saw the function first, so a missing grammar cannot make
+ # this pass by producing no rows at all.
+ assert _walk(source, "thing_test.go", "go")["TestThing"] == (0, 1)
+ assert _detect(source, path="thing_test.go", language="go") == []
+
+
+# ---------------------------------------------------------------------------
+# TypeScript / JavaScript
+# ---------------------------------------------------------------------------
+
+
+_TS_SATURATED = """
+describe("thing", () => {
+ it("passes whatever the code does", () => {
+ const a = vi.fn();
+ const b = vi.fn();
+ const c = vi.fn();
+ const d = vi.fn();
+ const e = vi.fn();
+ const f = vi.fn();
+ expect(a).toBeDefined();
+ });
+});
+"""
+
+
+ ("language", "path"),
+ [("typescript", "tests/thing.test.ts"), ("javascript", "tests/thing.test.js")],
+)
+def test_a_saturated_it_callback_fires(language: str, path: str) -> None:
+ """The dialect reaches both tags, which share one row."""
+ _require(language)
+ findings = _detect(_TS_SATURATED, path=path, language=language)
+ assert len(findings) == 1
+ assert findings[0].details["mock_setup_count"] == 6
+ assert findings[0].details["assertion_count"] == 1
+
+
+def test_each_it_callback_is_counted_separately() -> None:
+ """A ``describe`` body is not a function entry, so its ``it``s are.
+
+ Both callbacks are named ``"it callback"``; a name-keyed view keeps one.
+ """
+ _require("typescript")
+ rows = _rows(
+ """
+describe("thing", () => {
+ it("first", () => {
+ const a = vi.fn();
+ expect(a).toBeDefined();
+ });
+ it("second", () => {
+ const b = vi.fn();
+ const c = vi.fn();
+ expect(b).toBeDefined();
+ });
+});
+""",
+ "tests/thing.test.ts",
+ "typescript",
+ )
+ assert sorted(rows) == [(1, 1), (2, 1)]
+
+
+def test_both_it_callbacks_reach_the_detector() -> None:
+ """The collapse this guards against silently hid every test but one."""
+ _require("typescript")
+ source = """
+describe("thing", () => {
+ it("one", () => {
+ const a = vi.fn();
+ const b = vi.fn();
+ const c = vi.fn();
+ const d = vi.fn();
+ const e = vi.fn();
+ const f = vi.fn();
+ expect(a).toBeDefined();
+ });
+ it("two", () => {
+ const g = vi.fn();
+ const h = vi.fn();
+ const i = vi.fn();
+ const j = vi.fn();
+ const k = vi.fn();
+ const l = vi.fn();
+ expect(g).toBeDefined();
+ });
+});
+"""
+ findings = _detect(source, path="tests/thing.test.ts", language="typescript")
+ assert len(findings) == 2, "a name-keyed view would report only one"
+
+
+def test_arranging_the_test_environment_is_not_mock_setup() -> None:
+ """``vi.useFakeTimers`` arranges the run; only doubling counts.
+
+ The same split ``monkeypatch.setenv`` forced for Python.
+ """
+ _require("typescript")
+ counts = _rows(
"""
describe("thing", () => {
it("works", () => {
- const a = jest.fn();
- const b = jest.fn();
- const c = jest.fn();
- const d = jest.fn();
- const e = jest.fn();
- const f = jest.fn();
+ vi.useFakeTimers();
+ vi.setSystemTime(0);
+ vi.stubEnv("MODE", "test");
+ const a = vi.fn();
expect(a).toBeDefined();
});
});
""",
- path="tests/thing.test.ts",
- language="typescript",
+ "tests/thing.test.ts",
+ "typescript",
)
- assert findings == []
+ assert counts == [(1, 1)]
+
+
+def test_java_verify_is_not_an_assertion() -> None:
+ """``verify(...)`` must never satisfy the assertion count.
+
+ SonarQube's S2699 treats it as satisfying a test's assertion requirement.
+ Ours must not: a test built entirely of mocks and verifies is the thing
+ this marker measures, and counting verifies would hide exactly that.
+ This is also why Java carries no dialect -- with its real checks excluded,
+ an over-mocked Java test reaches the ratio with a vacuous denominator.
+ """
+ _require("java")
+ counts = _walk(
+ """
+class ThingTest {
+ @Test
+ void sendsTheMessage() {
+ Mockito.verify(repository).save(entity);
+ Mockito.verify(sender).send(message);
+ verify(listener).onDone();
+ assertEquals(1, result);
+ }
+}
+""",
+ "src/test/java/ThingTest.java",
+ "java",
+ )
+ assert counts["sendsTheMessage"][1] == 1, "only assertEquals is an assertion"
# ---------------------------------------------------------------------------
diff --git a/tests/unit/health/test_model_version_coupling.py b/tests/unit/health/test_model_version_coupling.py
index ede2d0e5e..2ac0caa34 100644
--- a/tests/unit/health/test_model_version_coupling.py
+++ b/tests/unit/health/test_model_version_coupling.py
@@ -22,7 +22,7 @@ from repowise.core.analysis.health.refactoring.identity import (
# The three stamps as they stand together. Moving either identity model means
# moving the analyzer with it, and updating this tuple in the same commit.
-_STAMPS = (12, 2, 2)
+_STAMPS = (13, 2, 2)
def test_the_identity_models_and_the_analyzer_stamp_are_pinned_together() -> None: