I'm using Mill and I can't figure out how to run the tests or even compile all Modules at once.
There is clear
, but running mill resolve _
does not seem to have a command for it.
For now I run the tests for each Module separately.
Is there a way to achieve this?
Edit: The Answer targets an outdated Mill version. See below for an updated version.
I assume you're talking about ScalaModule
s and your tests are located in test
sub-modules.
Run all tests of your project with:
mill __.test.test
The __
is a wildcard and matches in this case any parent module(s) (like the **
in Ant patterns). The .test.test
matches a test
target in a module named test
.
To compile all modules, run:
mill __.compile
And to run all compile targets and run tests in one go, run:
mill all __.compile __.test.test
Notice, that we need to use the all
target here, which accepts multiple targets as arguments. That's needed because mill only accepts a single target or target-pattern and treats any additional command line argument as a parameter for that target.
Edit:
Newer versions of Mill no longer have the all
command. Instead, you can give multiple targets separated with +
.
mill __.compile + __.test
Also, to run all test
targets, it's enough to run mill __.test
. In very older Mill versions, this results in tests running twice, but this is fixed for a long time and the workaround to use __.test.test
is no longer needed.