From cacf76a15fc60360f863de076826bc416ee92e42 Mon Sep 17 00:00:00 2001 From: ShryukGrandhi <85529990+ShryukGrandhi@users.noreply.github.com> Date: Tue, 20 Oct 2026 17:37:06 -0700 Subject: [PATCH] fix(core): classify module.test-utils files as test support (#3269) --- packages/core/src/repowise/core/test_paths.py | 9 ++++++++- tests/unit/test_test_paths.py | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/core/src/repowise/core/test_paths.py b/packages/core/src/repowise/core/test_paths.py index f67f84b0ff..ec33dbfebf 100644 --- a/packages/core/src/repowise/core/test_paths.py +++ b/packages/core/src/repowise/core/test_paths.py @@ -208,6 +208,10 @@ {"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: @@ -369,7 +373,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 a98f608c30..c5a6227e61 100644 --- a/tests/unit/test_test_paths.py +++ b/tests/unit/test_test_paths.py @@ -294,6 +294,12 @@ ("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, ""),