Leave out of a task-bench fix a change Haiku makes to a PHP or JavaScript test that PHPUnit or node --test finds by its name

This commit is contained in:
2026-11-27 21:57:32 +01:00
parent 2abe472919
commit 53b0f6ed30
7 changed files with 58 additions and 8 deletions
+15
View File
@@ -0,0 +1,15 @@
"""Which files PHPUnit and `node --test` find as tests by their names, beyond the ones `mutate_changes.changed_lines.is_test` tells.
`is_test` stays as it is: changing it would change what `mutate-changes` skips."""
import posixpath
import re
from mutate_changes.changed_lines import is_test, STRYKER
# PHPUnit's default suffix, wherever the file stands; node --test's `*-test`, `*_test`, `test-*` and `test` stems, in each suffix
# Stryker covers. node --test's `*.test.*` is `is_test`'s already.
FRAMEWORK_NAME = re.compile(rf".*Test\.php|(?:.*[-_]test|test|test-.*)(?:{'|'.join(re.escape(suffix) for suffix in STRYKER)})")
def is_test_file(path: str) -> bool:
"""Whether path is a test by its name or folder alone, as `is_test` or PHPUnit or `node --test` tells it."""
return is_test(path) or bool(FRAMEWORK_NAME.fullmatch(posixpath.basename(path)))