Repository navigation
fix(sbt): filter selective test tasks (testOnly, testQuick) - #3139
Closed
randomBrainstormer wants to merge 2 commits into
Closed
randomBrainstormer wants to merge 2 commits into
randomBrainstormer wants to merge 2 commits into
Conversation
`sbt testOnly <spec>` and `sbt testQuick` emit standard ScalaTest/munit output but were passed through unfiltered: - The rewrite rule's subcommand alternation didn't list them, so `sbt testOnly ...` was never rewritten to `rtk sbt ...`. - Even when invoked as `rtk sbt testOnly ...`, run_other only recognized integration-test tasks (:test / /test), so these fell through to run_passthrough. Recognize testOnly/testQuick (and scoped forms like Test/testOnly) as test-producing tasks and route them through runner::run_filtered with filter_sbt_test, so the never_worse cap and tee hint apply. Add the tasks to the rewrite rule, keeping the (?:\s|$) anchor so custom tasks like `testify` are not rewritten.
- Inline the selective-test task check as matches!(...) to mirror is_integration_test_cmd instead of a separate const + contains(). - Reorder run_other so subcommand moves into args_display (drop the clone), computing the tee label first. - Document sbt testOnly in the README supported-commands list.
Contributor
Author
|
closing in favor of #3140 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Follow-up to #752.
sbt testOnly <spec>andsbt testQuick— the commands you run to execute a single test or the just-changed tests, the tightest inner loop for a Scala dev — were passed through unfiltered, even though they emit the exact same ScalaTest/munit output thatfilter_sbt_testalready handles.Reported by @greenhost87 on #752:
Why it slipped through
Two layers, both missing the task:
src/discover/rules.rs): the subcommand alternation listedtestbut nottestOnly/testQuick. With the(?:\s|$)anchor,testcannot matchtestOnly, sosbt testOnly …was never rewritten tortk sbt ….src/cmds/scala/sbt_cmd.rs): even asrtk sbt testOnly …,run_otheronly recognized integration-test tasks (:test//testsuffixes) and fell through torun_passthrough.Change
testOnly/testQuickto the rewrite alternation, keeping the(?:\s|$)anchor so custom tasks liketestifyare still not rewritten.is_test_cmd()helper recognizestestOnly/testQuickand their scoped forms (Test/testOnly,it:testQuick, …) in addition to the existing integration-test tasks.run_otherroutes all test-producing tasks throughrunner::run_filteredwithfilter_sbt_test, so thenever_worsecap and tee hint apply (Transparency) — same shared-runner shape as the rest of the module.No new output format; the filter itself is unchanged and already covered by fixtures.
Tests
test_is_test_cmd— bare + scopedtestOnly/testQuick, integration tasks, and negatives (compile,assembly,update,testable).test_rewrite_sbt_test_only/test_rewrite_sbt_does_not_match_unrelated_tasks.cargo fmt --all --check✅ ·cargo clippy --all-targets(no warnings) ✅ ·cargo test --all(2520 passed) ✅🤖 Generated with Claude Code