Minor: print errors to stderr when gradle test build
It takes time to find compile errors or exceptions, when a Gradle test build fails, because a debug log is very verbose. This change prints all error messages from Gradle when a test build fails unexpectedly.
This commit is contained in:
+13
-3
@@ -191,9 +191,19 @@ abstract class BaseGradleIT {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun CompiledProject.assertSuccessful(): CompiledProject {
|
fun CompiledProject.assertSuccessful() {
|
||||||
assertEquals(0, resultCode, "Gradle build failed")
|
if (resultCode == 0) return
|
||||||
return this
|
|
||||||
|
val errors = "(?m)^.*\\[ERROR] \\[\\S+] (.*)$".toRegex().findAll(output)
|
||||||
|
val errorMessage = buildString {
|
||||||
|
appendln("Gradle build failed")
|
||||||
|
appendln()
|
||||||
|
if (errors.any()) {
|
||||||
|
appendln("Possible errors:")
|
||||||
|
errors.forEach { match -> appendln(match.groupValues[1]) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fail(errorMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun CompiledProject.assertFailed(): CompiledProject {
|
fun CompiledProject.assertFailed(): CompiledProject {
|
||||||
|
|||||||
Reference in New Issue
Block a user