test_script: Use alphabetically first matches in find_js_test_files.

Otherwise the behavior depends on the filesystem order.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-04-10 02:18:55 -07:00 committed by Anders Kaseorg
parent 4a04cda956
commit d4c8b01530
1 changed files with 4 additions and 6 deletions

View File

@ -105,12 +105,10 @@ def add_provision_check_override_param(parser: ArgumentParser) -> None:
def find_js_test_files(test_dir: str, files: Iterable[str]) -> List[str]:
test_files = []
for file in files:
for file_name in os.listdir(test_dir):
if file_name.startswith(file):
file = file_name
break
if not os.path.exists(file):
file = os.path.join(test_dir, file)
file = min(
(file_name for file_name in os.listdir(test_dir) if file_name.startswith(file)),
default=os.path.join(test_dir, file),
)
test_files.append(os.path.abspath(file))
if not test_files: