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.

fix(core): classify module.test-utils files as test support (#4353)

ShryukGrandhif7d53635ed19
diff --git a/packages/core/src/repowise/core/test_paths.py b/packages/core/src/repowise/core/test_paths.py
index 544bf8660..86016937f 100644
--- a/packages/core/src/repowise/core/test_paths.py
+++ b/packages/core/src/repowise/core/test_paths.py
@@ -221,6 +221,10 @@ _SUPPORT_NAME_WORDS: frozenset[str] = frozenset(
{"harness", "support", "helper", "helpers", "mock", "mocks", "fixture", "fixtures", "setup"}
)
+# ``utils`` reads as support only when a dot ties it to a module
+# (``foo.test-utils.ts``), which no published ``test-utils`` entry is named.
+_QUALIFIED_SUPPORT_NAME_WORDS: frozenset[str] = frozenset({"utils", "util"})
+
@dataclass(frozen=True, slots=True)
class _Conventions:
@@ -384,7 +388,10 @@ def _is_support_compound(filename: str) -> bool:
return (
len(words) >= 2
and words[-2] == "test"
- and words[-1] in _SUPPORT_NAME_WORDS
+ and (
+ words[-1] in _SUPPORT_NAME_WORDS
+ or (words[-1] in _QUALIFIED_SUPPORT_NAME_WORDS and "." in lowered.stem)
+ )
and lowered.suffix in _conventions().source_exts
and not _is_test_name(filename)
)
diff --git a/tests/unit/test_test_paths.py b/tests/unit/test_test_paths.py
index 85483feef..05f3baf93 100644
--- a/tests/unit/test_test_paths.py
+++ b/tests/unit/test_test_paths.py
@@ -310,6 +310,12 @@ _CORPUS: tuple[tuple[str, str | None, str], ...] = (
("src/media-understanding/runner.test-mocks.ts", None, "support"),
("extensions/comfy/test-helpers.ts", None, "support"),
("src/cron/isolated-agent.test-setup.ts", None, "support"),
+ # #3269: a module's own ``.test-*`` companion, beside it in src/.
+ ("src/foo.test-support.ts", None, "support"),
+ ("src/foo.test-helpers.ts", None, "support"),
+ ("src/foo.test-utils.ts", None, "support"),
+ ("src/foo.test-utils.js", None, "support"),
+ ("src/test-supporter.ts", None, ""),
# ``test-utils`` is a published entry in React and Preact; ``setup`` alone
# is a build script or an app's bootstrap.
("src/test-utils.ts", None, ""),