You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dev-cmd/tests: find changed tests when split inside directory - #24494
Have you checked for other open Pull Requests for the same change?
Have you explained what your changes do? Performance claims (e.g. "this is faster") must include brew benchmark results.
Have you explained why you'd like these changes included, not just what they do?
For bug fixes, have you given step-by-step brew commands to reproduce the bug?
Have you written new tests (excluding integration tests)? Here's an example.
Have you successfully run brew lgtm (style, typechecking and tests) locally?
I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.
Updated changed-test detection to find specifications nested in a file-specific test directory when no matching top-level specification exists. Existing handling of changed files within the test directory remains unchanged. This helps the development command associate modified files with their relevant tests in more cases.
For changed Ruby files outside test/, changed_test_files now uses the associated spec when it exists. Otherwise, it selects specs from the matching test subdirectory.
changed_test_files checks whether the associated spec exists. If it does not, the method selects specs from the matching test subdirectory.
Merge Risk: Minimal · up to b9c20
No merge-blocking runtime risk is established; add the focused regression test to prevent this behavior from regressing.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: finding changed tests that are split within a directory.
Description check
The description explains the skipped RuboCop tests, the reason for the change, and the reported validation step. It is directly related to the changeset.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Add a regression example for the split-spec fallback in changed_test_files.
The new Pathname.glob("test/#{filestub}/*_spec.rb") branch at Library/Homebrew/dev-cmd/tests.rb:329-330 has no example in Library/Homebrew/test/dev-cmd/tests_spec.rb:314-371. Reverting it to the unconditional associated-spec path would still pass every current example. A later change could then drop split specs silently and reintroduce the skipped RuboCop tests this PR fixes.
Add a context to that describe block. It should stub Utils::Git.changed_files with a source file that has no associated spec but has specs under test/<filestub>/, such as Library/Homebrew/rubocops/bottle.rb. It should then assert that the returned list includes the split spec files, for example test/rubocops/bottle/bottle_format_spec.rb.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 0f4e3044-d5e5-4c1f-9931-6ae320d76eb5
Commits
Reviewing files that changed from the base of the PR and between d4824f1 and b9c204c.
Files selected for processing: 1
Library/Homebrew/dev-cmd/tests.rb
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mainly needed for RuboCop tests which still have multiple classes inside files so
brew lgtmends up skipping tests.e.g. https://github.com/Homebrew/brew/tree/main/Library/Homebrew/test/rubocops/lines
Later on, we could move cop classes to separate files.
brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?