trait Junit5 extends BaseClass with TestModule
TestModule that uses JUnit 5 Framework to run tests. You may want to provide the junit dependency explicitly to use another version.
- Source
- TestModule.scala
- Alphabetic
- By Inheritance
- Junit5
- TestModule
- TaskModule
- RunModule
- WithZincWorker
- JavaModuleBase
- BspModule
- Module
- BaseClass
- Cacher
- Cacher
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def compile: T[CompilationResult]
- Definition Classes
- TestModule
Concrete Value Members
- object millInternal extends Internal
Miscellaneous machinery around traversing & querying the build hierarchy, that should not be needed by normal users of Mill
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def allLocalMainClasses: T[Seq[String]]
- Definition Classes
- RunModule
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def bspBuildTarget: BspBuildTarget
Use to fill most fields of
BuildTarget
.Use to fill most fields of
BuildTarget
.- Definition Classes
- TestModule → BspModule
- def bspBuildTargetData: define.Task[Option[(String, AnyRef)]]
Use to populate the
BuildTarget.{dataKind,data}
fields. - def bspDisplayName: String
- Definition Classes
- BspModule
- def bspDisplayName0: String
- Definition Classes
- BspModule
- def cachedTarget[T](t: => T)(implicit c: Enclosing): T
- Attributes
- protected[this]
- Definition Classes
- Cacher → Cacher
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- def defaultCommandName(): String
The name of the default command, which will be automatically executed if the module name is provided at the Mill command line.
The name of the default command, which will be automatically executed if the module name is provided at the Mill command line.
- Definition Classes
- TestModule → TaskModule
- def discoveredTestClasses: T[Seq[String]]
Overridden since Junit5 has its own discovery mechanism.
Overridden since Junit5 has its own discovery mechanism.
This is basically a re-implementation of sbt's plugin for Junit5 test discovery mechanism. See https://github.com/sbt/sbt-jupiter-interface/blob/468d4f31f1f6ce8529fff8a8804dd733974c7686/src/plugin/src/main/scala/com/github/sbt/junit/jupiter/sbt/JupiterPlugin.scala#L97C15-L118 for details.
Note that we access the test discovery via reflection, to avoid mill itself having a dependency on Junit5. Hence, if you remove the
sbt-jupiter-interface
dependency fromivyDeps
, make sure to also override this method.- Definition Classes
- Junit5 → TestModule
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalMainClass: T[String]
- Definition Classes
- RunModule
- def finalMainClassOpt: T[Either[String, String]]
- Definition Classes
- RunModule
- def forkArgs: T[Seq[String]]
Any command-line parameters you want to pass to the forked JVM.
Any command-line parameters you want to pass to the forked JVM.
- Definition Classes
- RunModule
- def forkEnv: T[Map[String, String]]
Any environment variables you want to pass to the forked JVM.
Any environment variables you want to pass to the forked JVM.
- Definition Classes
- RunModule
- def forkWorkingDir: T[Path]
- Definition Classes
- RunModule
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def getTestEnvironmentVars(args: String*): define.Command[(String, String, String, Seq[String])]
- Definition Classes
- TestModule
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def ivyDeps: T[Agg[Dep]]
- Definition Classes
- Junit5 → JavaModuleBase
- def localRunClasspath: T[Seq[api.PathRef]]
The elements of the run classpath which are local to this module.
The elements of the run classpath which are local to this module. This is typically the output of a compilation step and bundles runtime resources.
- Definition Classes
- RunModule
- def mainClass: T[Option[String]]
Allows you to specify an explicit main class to use for the
run
command.Allows you to specify an explicit main class to use for the
run
command. If none is specified, the classpath is searched for an appropriate main class to use if one exists.- Definition Classes
- RunModule
- implicit def millModuleBasePath: BasePath
- Definition Classes
- Module
- def millModuleDirectChildren: Seq[define.Module]
- Definition Classes
- Module
- implicit def millModuleExternal: External
- Definition Classes
- Module
- implicit def millModuleSegments: Segments
- Definition Classes
- Module
- implicit def millModuleShared: Foreign
- Definition Classes
- Module
- def millOuterCtx: Ctx
- Definition Classes
- BaseClass
- def millSourcePath: Path
- Definition Classes
- Module
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def resources: T[Seq[api.PathRef]]
- Definition Classes
- JavaModuleBase
- def run(args: define.Task[Args] = Task.Anon(Args())): define.Command[Unit]
Runs this module's code in a subprocess and waits for it to finish
Runs this module's code in a subprocess and waits for it to finish
- Definition Classes
- RunModule
- def runBackgroundLogToConsole: Boolean
If true, stdout and stderr of the process executed by
runBackground
orrunMainBackground
is sent to mill's stdout/stderr (which usually flow to the console).If true, stdout and stderr of the process executed by
runBackground
orrunMainBackground
is sent to mill's stdout/stderr (which usually flow to the console).If false, output will be directed to files
stdout.log
andstderr.log
inrunBackground.dest
(orrunMainBackground.dest
)- Definition Classes
- RunModule
- def runBackgroundRestartDelayMillis: T[Int]
- Definition Classes
- RunModule
- def runBackgroundTask(mainClass: define.Task[String], args: define.Task[Args] = Task.Anon(Args())): define.Task[Unit]
- Definition Classes
- RunModule
- def runClasspath: T[Seq[api.PathRef]]
All classfiles and resources including upstream modules and dependencies necessary to run this module's code.
All classfiles and resources including upstream modules and dependencies necessary to run this module's code.
- Definition Classes
- RunModule
- def runForkedTask(mainClass: define.Task[String], args: define.Task[Args] = Task.Anon(Args())): define.Task[Unit]
Runs this module's code in a subprocess and waits for it to finish
Runs this module's code in a subprocess and waits for it to finish
- Definition Classes
- RunModule
- def runLocal(args: define.Task[Args] = Task.Anon(Args())): define.Command[Unit]
Runs this module's code in-process within an isolated classloader.
Runs this module's code in-process within an isolated classloader. This is faster than
run
, but in exchange you have less isolation between runs since the code can dirty the parent Mill process and potentially leave it in a bad state.- Definition Classes
- RunModule
- def runLocalTask(mainClass: define.Task[String], args: define.Task[Args] = Task.Anon(Args())): define.Task[Unit]
- Definition Classes
- RunModule
- def runMain(mainClass: String, args: String*): define.Command[Unit]
Same as
run
, but lets you specify a main class to runSame as
run
, but lets you specify a main class to run- Definition Classes
- RunModule
- def runMainBackground(mainClass: String, args: String*): define.Command[Unit]
Same as
runBackground
, but lets you specify a main class to runSame as
runBackground
, but lets you specify a main class to run- Definition Classes
- RunModule
- def runMainLocal(mainClass: String, args: String*): define.Command[Unit]
Same as
runLocal
, but lets you specify a main class to runSame as
runLocal
, but lets you specify a main class to run- Definition Classes
- RunModule
- def runUseArgsFile: T[Boolean]
Control whether
run*
-targets should use an args file to pass command line args, if possible.Control whether
run*
-targets should use an args file to pass command line args, if possible.- Definition Classes
- RunModule
- def runner: define.Task[Runner]
- Definition Classes
- RunModule
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def test(args: String*): define.Command[(String, Seq[TestResult])]
Discovers and runs the module's tests in a subprocess, reporting the results to the console.
Discovers and runs the module's tests in a subprocess, reporting the results to the console.
- Definition Classes
- TestModule
- See also
- def testCached: T[(String, Seq[TestResult])]
Discovers and runs the module's tests in a subprocess, reporting the results to the console.
Discovers and runs the module's tests in a subprocess, reporting the results to the console. If no input has changed since the last run, no test were executed.
- Definition Classes
- TestModule
- See also
test()
- def testCachedArgs: T[Seq[String]]
Args to be used by testCached.
Args to be used by testCached.
- Definition Classes
- TestModule
- def testClasspath: T[Seq[api.PathRef]]
The classpath containing the tests.
The classpath containing the tests. This is most likely the output of the compilation target. By default, this uses the result of localRunClasspath, which is most likely the result of a local compilation.
- Definition Classes
- TestModule
- def testForkGrouping: T[Seq[Seq[String]]]
How the test classes in this module will be split into multiple JVM processes and run in parallel during testing.
How the test classes in this module will be split into multiple JVM processes and run in parallel during testing. Defaults to all of them running in one process sequentially, but can be overriden to split them into separate groups that run in parallel.
- Definition Classes
- TestModule
- def testFramework: T[String]
The test framework to use.
The test framework to use.
For convenience, you can also mix-in one of these predefined traits: - TestModule.Junit4 - TestModule.Junit5 - TestModule.Munit - TestModule.ScalaTest - TestModule.Specs2 - TestModule.TestNg - TestModule.Utest - TestModule.Weaver - TestModule.ZioTest
- Definition Classes
- Junit5 → TestModule
- def testLocal(args: String*): define.Command[(String, Seq[TestResult])]
Discovers and runs the module's tests in-process in an isolated classloader, reporting the results to the console
Discovers and runs the module's tests in-process in an isolated classloader, reporting the results to the console
- Definition Classes
- TestModule
- def testOnly(args: String*): define.Command[(String, Seq[TestResult])]
Discovers and runs the module's tests in a subprocess, reporting the results to the console.
Discovers and runs the module's tests in a subprocess, reporting the results to the console. Arguments before "--" will be used as wildcard selector to select test classes, arguments after "--" will be passed as regular arguments.
testOnly *foo foobar bar* -- arguments
will test only classes with name (includes package name) 1. end with "foo", 2. exactly "foobar", 3. start with "bar", with "arguments" as arguments passing to test framework.- Definition Classes
- TestModule
- def testReportXml: T[Option[String]]
Sets the file name for the generated JUnit-compatible test report.
Sets the file name for the generated JUnit-compatible test report. If None is set, no file will be generated.
- Definition Classes
- TestModule
- def testSandboxWorkingDir: T[Boolean]
Whether to use the test task destination folder as the working directory when running tests.
Whether to use the test task destination folder as the working directory when running tests.
true
means test subprocess run in the.dest/sandbox
folder of the test task, providing better isolation and encouragement of best practices (e.g. not reading/writing stuff randomly from the project source tree).false
means the test subprocess runs in the project root folder, providing weaker isolation.- Definition Classes
- TestModule
- def testTask(args: define.Task[Seq[String]], globSelectors: define.Task[Seq[String]]): define.Task[(String, Seq[TestResult])]
The actual task shared by
test
-tasks that runs test in a forked JVM.The actual task shared by
test
-tasks that runs test in a forked JVM.- Attributes
- protected
- Definition Classes
- TestModule
- def testUseArgsFile: T[Boolean]
Controls whether the TestRunner should receive its arguments via an args-file instead of a long parameter list.
Controls whether the TestRunner should receive its arguments via an args-file instead of a long parameter list. Defaults to what
runUseArgsFile
return.- Definition Classes
- TestModule
- def toString(): String
- Definition Classes
- Module → AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def zincWorker: ModuleRef[ZincWorkerModule]
- Definition Classes
- WithZincWorker
Deprecated Value Members
- def doRunBackground(taskDest: Path, runClasspath: Seq[api.PathRef], zwBackgroundWrapperClasspath: Agg[api.PathRef], forkArgs: Seq[String], forkEnv: Map[String, String], finalMainClass: String, forkWorkingDir: Path, runUseArgsFile: Boolean, backgroundOutputs: Option[(ProcessOutput, ProcessOutput)])(args: String*): (Ctx) => Result[Unit]
- Attributes
- protected
- Definition Classes
- RunModule
- Annotations
- @deprecated
- Deprecated
(Since version Mill 0.12.0) Binary compat shim, use
.runner().run(..., background=true)
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)