What is the Kotlin version of this code snippet from Groovy Gradle?
test {
testLogging {
events "passed", "skipped", "failed"
}
}
I tried setting the testLogging events inside tasks.test, but it gives a compile-time error.
tasks.test {
useJUnitPlatform()
testLogging.events = listOf("PASSED", "FAILED", "SKIPPED")
}
In Kotlin DSL, to set the testLogging
events, you can do it like this:
tasks.test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
Here, inside the testLogging
block, we call the events
function and specify the events you want. In your code, there's a small mistake; instead of testLogging.events = listOf(...)
, you should use events(...)
directly.