-
How can I add my custom TestRunner to mill?
Here is my build.mill: package build
import mill._, kotlinlib._
object `package` extends RootModule with KotlinModule {
def kotlinVersion = "2.0.21"
def sources = T.sources {
super.sources() ++ Seq(PathRef(millSourcePath / "src"))
}
def resources = T.sources {
super.resources() ++ Seq(PathRef(millSourcePath / ".res"))
}
def ivyDeps = Agg(
ivy"org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0"
)
object test extends KotlinTests with TestModule {
override def testFramework: T[String] = "test.TesterKt"
def sources = T.sources {
super.sources() ++ Seq(PathRef(millSourcePath / "test"))
}
}
} My project structure looks like this, where the Tester.kt has a main function.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
@rtc11 looks like your source configuration is incorrect. Just eyeballing You probably want something like package build
import mill._, kotlinlib._
object `package` extends RootModule with KotlinModule {
def kotlinVersion = "2.0.21"
def sources = T.sources {
super.sources() ++ Seq(PathRef(millSourcePath / "src"))
}
def resources = T.sources {
super.resources() ++ Seq(PathRef(millSourcePath / ".res"))
}
def ivyDeps = Agg(
ivy"org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0"
)
object test extends KotlinTests with TestModule {
override def testFramework: T[String] = "test.TesterKt"
def sources = T.sources {
super.sources() ++ Seq(PathRef(millSourcePath / "server"))
}
}
} You can debug this by running |
Beta Was this translation helpful? Give feedback.
You probably don't need to inherit
TestModule
directly, since it comes as part ofKotlinTests
.You can move shared module configuration into
trait
s that you re-use where-ever necessary, as discussed in https://mill-build.org/mill/kotlinlib/intro.html#_multi_module_project. This applies to both normal modules and test modules (and any other modules you create)