Skip to content

pr_runtime: treat .test.tsx, .spec.jsx and .test.mjs files as tests - #191

Draft
RizgarOzan wants to merge 1 commit into
huggingface:mainfrom
RizgarOzan:fix/tsx-test-files
Draft

RizgarOzan wants to merge 1 commit into
huggingface:mainfrom
RizgarOzan:fix/tsx-test-files

Conversation

@RizgarOzan

Copy link
Copy Markdown
Contributor

Summary

  • _path_is_test now matches jest/vitest test file names with any of the usual extensions (.test.tsx, .spec.jsx, .test.mjs, .spec.cts, ...), using vitest's default include pattern. Before, only .test/.spec with .ts and .js counted, so a colocated src/Button.test.tsx went into the source patch and the PR was skipped as no_test_patch.

Test plan

  • New test_path_is_test_matches_jsx_tsx_and_module_js_test_files in tests/test_pipeline_pr_runtime.py (four positive cases, plus Button.tsx and test.config.ts staying non-tests). Fails on main, passes here.
  • split_patch_and_test_patch on a diff touching src/Button.tsx + src/Button.test.tsx: the test file now lands in the test patch.
  • test_pipeline_pr_runtime + test_pipeline_commit_runtime: 91 passed. uv run ruff check . and uv run ruff format --check . clean, generate_metrics.py --check passes.
  • Full pytest -q on Windows (without test_modal_transfer.py, which needs harbor from the extras): 213 failed / 68 errors, the same as clean main on this machine (file modes, symlinks); the only difference is the new passing test. generate_prompt_reference.py --check also fails on clean main here because of CRLF checkout, so I couldn't use it locally; this change doesn't touch prompts.

Out of scope

  • The test_* prefix rule still only covers .py, .js and .ts; I left it alone.

Closes #190

_path_is_test only knew .test/.spec with .ts and .js, so a colocated React test like Button.test.tsx went into the source patch and the PR was skipped as no_test_patch. Match vitest's default include pattern instead.

Closes huggingface#190
@RizgarOzan
RizgarOzan marked this pull request as draft October 11, 2026 09:33
@RizgarOzan

Copy link
Copy Markdown
Contributor Author

Keeping this as a draft until #189 is reviewed, so there's only one PR of mine in your queue at a time. It's complete and tested; I'll mark it ready after that one lands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pr_runtime: .test.tsx / .spec.jsx / .test.mjs files aren't treated as tests

1 participant