Skip to content

Commit

Permalink
Add zio-test to TestModule (#2432)
Browse files Browse the repository at this point in the history
Pull request: #2432

Co-authored-by: Tobias Roeser <[email protected]>
  • Loading branch information
carlosedp and lefou authored Apr 15, 2023
1 parent 70c6e44 commit 18711b6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
20 changes: 20 additions & 0 deletions docs/antora/modules/ROOT/pages/Configuration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion readme.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions scalalib/src/mill/scalalib/TestModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 18711b6

Please sign in to comment.