Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add zio-test to TestModule #2432

Merged
merged 4 commits into from
Apr 15, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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