I can’t seem to be able to enable logging for Kote...
# kotest
w
I can’t seem to be able to enable logging for Kotest 😕 Any idea what I may be missing? I want to see logs in console when running tasks, I tried: • setting
systemProp.KOTEST_DEBUG=true
in
gradle.properties
tasks.withType(Test) { systemProperty("KOTEST_DEBUG", true) }
• exporting KOTEST_DEBUG env variable in console • passing -DKOTEST_DEBUG=true in ./gradlew params
Tests definitely run as I also have
outputs.upToDateWhen { false }
for them, also I see them running
s
I couldn't get it to work yesterday either, it seems to sometimes pass sys props through and other times not
if you can do
export KOTEST_DEBUG=true
then it should set that env in all forked processes too
w
Shoot, that’s why you just changed
enabled() = true
? 😄 I did export
KOTEST_DEBUG
, no luck 😞
s
yes that's why I changed it when I was testing lol
it still didn't work properly
I think gradle is just not logging the output, rather than the flag not being set
gradle is capturing std out and is suopposed to be redirecting it to the file
And you need all this too
Copy code
tasks.named<Test>("jvmTest") {
   useJUnitPlatform()
   filter {
      isFailOnNoMatchingTests = false
   }
   testLogging {
      showExceptions = true
      showStandardStreams = true
      events = setOf(TestLogEvent.FAILED, TestLogEvent.PASSED)
      exceptionFormat = TestExceptionFormat.FULL
   }
}
w
showStandardStreams = true
that’s the fix, I think Gradle starts redirecting
System.out
as soon as
test
task starts 🙄
s
does it work now ?
w
Yep 🙂 This is enough:
Copy code
allprojects {
  tasks.withType(Test) {
    systemProperty("KOTEST_DEBUG", true)
    testLogging {
      showStandardStreams = true
    }
  }
}
s
perf
should update the docs
w
I wonder if you can somehow get ahold of the real system out 🤔
s
gradle is a funny bastard, doesn't like you doing lots of things
had loads of issues writing the kotest gradle plugin
w
Fyi there’s Gradle Community Slack which is quite active 🙂 Useful if you’re stumped on some Gradle stuff and need to ask for guidance
s
oh I didn't know that
376 Views