diff --git a/docs/antora/modules/ROOT/pages/Configuration.adoc b/docs/antora/modules/ROOT/pages/Configuration.adoc index eafcdcfabea..a2f4a61cefc 100644 --- a/docs/antora/modules/ROOT/pages/Configuration.adoc +++ b/docs/antora/modules/ROOT/pages/Configuration.adoc @@ -190,6 +190,7 @@ For convenience, you can also use one of the predefined test frameworks: * `TestModule.ScalaTest` * `TestModule.Specs2` * `TestModule.Utest` +* `TestModule.ZioTest` .`build.sc`: `ScalaModule` with UTest tests using the predefined `TestModule.Utest` @@ -320,6 +321,25 @@ object foo extends ScalaModule { } ---- +ZIO-test example: + +.`build.sc` +[source,scala,subs="attributes,verbatim"] +---- +import mill._, scalalib._ + +object foo extends ScalaModule { + def scalaVersion = "{example-scala-3-version}" + + object test extends Tests with TestModule.ZioTest { + def ivyDeps = Agg( + ivy"dev.zio::zio-test:2.0.12", + ivy"dev.zio::zio-test-sbt:2.0.12", + ) + } +} +---- + After that, you can follow the instructions in <<_adding_a_test_suite>>, and use `mill foo.test` as usual, or pass args to the test suite via `mill foo.test arg1 arg2 arg3`. == Scala Compiler Plugins diff --git a/readme.adoc b/readme.adoc index 67d76cd5feb..64bc4259525 100644 --- a/readme.adoc +++ b/readme.adoc @@ -932,7 +932,7 @@ _Changes since {prev-version}:_ * `ScalaModule`: Support for Scala 3 * `CoursierModule`: Support customized dependency resolution (needed to work with ScalaFX) * `TestModule`: Added new `testFramework` target and only support one test framework. Deprecated `testFrameworks` targets. -* `TestModule`: Added new convenience traits to configure popular test frameworks, e.g. `TestModule.Junit4`, `TestModule.ScalaTest`, `TestModule.Utest`, and many more +* `TestModule`: Added new convenience traits to configure popular test frameworks, e.g. `TestModule.Junit4`, `TestModule.ScalaTest`, `TestModule.Utest` and many more * `Bloop`: Added support for foreign modules * Better support for Windows environments * Various internal improvements, cleanups, and deprecations diff --git a/scalalib/src/mill/scalalib/TestModule.scala b/scalalib/src/mill/scalalib/TestModule.scala index 5a808f3eff8..0d6b9a1c81c 100644 --- a/scalalib/src/mill/scalalib/TestModule.scala +++ b/scalalib/src/mill/scalalib/TestModule.scala @@ -242,6 +242,14 @@ object TestModule { override def testFramework: T[String] = "weaver.framework.CatsEffect" } + /** + * TestModule that uses ZIO Test Framework to run tests. + * You need to provide the zio-test dependencies yourself. + */ + trait ZioTest extends TestModule { + override def testFramework: T[String] = "zio.test.sbt.ZTestFramework" + } + @deprecated("Use other overload instead", "Mill after 0.10.2") def handleResults( doneMsg: String,