Add --test flag to query test-scope classpath (#84)#89
Open
rochala wants to merge 1 commit into
Open
Conversation
Project-aware commands (get/list/search) only ever resolved the compile-scope classpath, so symbols from test-only dependencies were never found. Add a `--test` flag that selects the test scope: - sbt: exports `<module>/Test/fullClasspath` - scala-cli: compiles with `--test` - Mill: rejected with guidance (test code is a separate module, e.g. `--module foo.test`), since Mill has no Compile/Test scope axis The classpath cache key includes the scope so compile/test results don't collide. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Problem
Closes #84.
Project-aware commands (
get/list/search) only ever resolved the compile-scope classpath, so symbols from test-only dependencies (e.g.munit.FunSuite) were never found. There was no way to reach the test classpath. As the issue notes, sbt's own--module server/Testsyntax doesn't work either — cellar just spliced it intoserver/Test/Compile/fullClasspath, which sbt rejects.Solution
A
--testflag on the project-aware commands selects the test scope. Each build tool maps it to its own model:--testbehaviorTest)<module>/Test/fullClasspath--test)--testfoo.test)--module foo.test; Mill has no Compile/Test scope axisThe classpath cache key now includes the scope, so compile- and test-scope results don't collide.
Verification
End-to-end, against a real project per build tool, querying a test-only munit dependency:
search --module core FunSuite→ empty;search --module core --test FunSuite→munit.FunSuite✅//> using test.dep): same before/after--test✅search --module lib --test FlatMap→--test is not supported for Mill projects: ... Query it directly, e.g. --module foo.test.(exit 1) ✅Full
lib.testsuite passes (372 tests), including a new test for the Mill rejection.🤖 Generated with Claude Code