I tried setting the following for all the tasks having type Test
as follows:
tasks.withType<Test> {
testLogging {
exceptionFormat = TestExceptionFormat.FULL
showStandardStreams = true
showStackTraces = true
}
}
But the setting only applies to the JVM, but not all the targets on Kolin/Multiplatform.
How to direct/enable the standard out and standard error streams to output in the console?
Only the exception name is printed in the console (not even the exception message):
> Task :keyboard:linuxX64Test FAILED
com.github.animeshz.keyboard.NativeKeyboardHandlerTest.Caps lock key should be toggled when KeyDown event is triggered FAILED
kotlin.IllegalStateException
com.github.animeshz.keyboard.NativeKeyboardHandlerTest.Test send and receive event FAILED
kotlin.IllegalStateException
I don't know how to debug this now, when I'm testing the library on multiple targets (on a VM) when I don't have (want to install) Intellij there.
You need to define testLogging
for each test task type as you are currently only defining it for JVM, something similar to this should work in your build.gradle.kts
:
tasks {
val jvmTest by getting(Test::class) {
testLogging {
events("PASSED", "FAILED", "SKIPPED")
exceptionFormat = TestExceptionFormat.FULL
showStandardStreams = true
showStackTraces = true
}
}
val linuxTest by getting(KotlinNativeTest::class) {
testLogging {
events("PASSED", "FAILED", "SKIPPED")
exceptionFormat = TestExceptionFormat.FULL
showStandardStreams = true
showStackTraces = true
}
}
val jsNodeTest by getting(KotlinJsTest::class) {
testLogging {
events("PASSED", "FAILED", "SKIPPED")
exceptionFormat = TestExceptionFormat.FULL
showStandardStreams = true
showStackTraces = true
}
}
}