Emit JUnit output whilst running gradle through CLI

Tweaks the gradle script to forward on test failures in a way that the
stack trace is preserved.

Previously, the stack pointed to a line after the test suite, e.g. line
101 on an 80 line file.
This commit is contained in:
David Fairbrother authored and Niels van Velzen committed 2021-12-28 18:54:17 +01:00
1 parent c7d8fe09a0
commit 480a71d1a6
1 file changed
+17
+17
View File
@@ -23,3 +23,20 @@ subprojects {
}
}
}
tasks.withType<Test> {
// Ensure Junit emits the full stack trace when a unit test fails through gradle
useJUnit()
testLogging {
events(
org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED,
org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_ERROR,
org.gradle.api.tasks.testing.logging.TestLogEvent.SKIPPED
)
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
showExceptions = true
showCauses = true
showStackTraces = true
}
}