Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/core/src/repowise/core/test_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
)
Expand Down
6 changes: 6 additions & 0 deletions tests/unit/test_test_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, ""),
Expand Down
Loading