Skip to content

Add --test flag to query test-scope classpath (#84)#89

Open
rochala wants to merge 1 commit into
mainfrom
feat/test-scope-classpath
Open

Add --test flag to query test-scope classpath (#84)#89
rochala wants to merge 1 commit into
mainfrom
feat/test-scope-classpath

Conversation

@rochala
Copy link
Copy Markdown
Contributor

@rochala rochala commented May 27, 2026

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/Test syntax doesn't work either — cellar just spliced it into server/Test/Compile/fullClasspath, which sbt rejects.

Solution

A --test flag on the project-aware commands selects the test scope. Each build tool maps it to its own model:

Build tool How test scope is modeled --test behavior
sbt config axis (Test) exports <module>/Test/fullClasspath
scala-cli config axis (--test) compiles with --test
Mill separate sub-module (e.g. foo.test) rejected with guidance — test code is already reachable via --module foo.test; Mill has no Compile/Test scope axis

The 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:

  • sbt multi-module project: search --module core FunSuite → empty; search --module core --test FunSuitemunit.FunSuite
  • scala-cli project (//> using test.dep): same before/after --test
  • Mill (this repo): search --module lib --test FlatMap--test is not supported for Mill projects: ... Query it directly, e.g. --module foo.test. (exit 1) ✅

Full lib.test suite passes (372 tests), including a new test for the Mill rejection.

🤖 Generated with Claude Code

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>
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.

Search in project module inside a test-scope classpath

1 participant