[Gradle] Support multiple failures in KotlinTestReport back again
This commit is contained in:
+16
-5
@@ -48,7 +48,7 @@ open class KotlinTestReport : TestReport() {
|
|||||||
@Transient
|
@Transient
|
||||||
private var parent: KotlinTestReport? = null
|
private var parent: KotlinTestReport? = null
|
||||||
|
|
||||||
// TODO: used in task action when the task is aggregate report, non compatible with configuration cache
|
// TODO: this field is used in task action when the task is aggregate report, which makes it incompatible with configuration cache
|
||||||
@Internal
|
@Internal
|
||||||
val children = mutableListOf<TaskProvider<KotlinTestReport>>()
|
val children = mutableListOf<TaskProvider<KotlinTestReport>>()
|
||||||
|
|
||||||
@@ -158,8 +158,10 @@ open class KotlinTestReport : TestReport() {
|
|||||||
val allSuppressedRunningFailures = mutableListOf<Pair<String, Error>>()
|
val allSuppressedRunningFailures = mutableListOf<Pair<String, Error>>()
|
||||||
|
|
||||||
fun visitSuppressedRunningFailures(report: KotlinTestReport) {
|
fun visitSuppressedRunningFailures(report: KotlinTestReport) {
|
||||||
report.suppressedRunningFailureListeners.filter { it.failure != null }.forEach {
|
report.suppressedRunningFailureListeners.forEach { listener ->
|
||||||
allSuppressedRunningFailures.add(it.taskPath to it.failure!!)
|
listener.failures.forEach { failure ->
|
||||||
|
allSuppressedRunningFailures.add(listener.taskPath to failure)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
report.children.forEach {
|
report.children.forEach {
|
||||||
@@ -246,10 +248,19 @@ open class KotlinTestReport : TestReport() {
|
|||||||
|
|
||||||
private class SuppressedTestRunningFailureListener(val taskPath: String) : KotlinTestRunnerListener {
|
private class SuppressedTestRunningFailureListener(val taskPath: String) : KotlinTestRunnerListener {
|
||||||
@Transient
|
@Transient
|
||||||
var failure: Error? = null
|
private var failuresMutable: MutableList<Error>? = mutableListOf()
|
||||||
|
|
||||||
|
val failures: List<Error>
|
||||||
|
get() = failuresMutable ?: emptyList()
|
||||||
|
|
||||||
override fun runningFailure(failure: Error) {
|
override fun runningFailure(failure: Error) {
|
||||||
this.failure = failure
|
var failures = failuresMutable
|
||||||
|
if (failures == null) {
|
||||||
|
// it is possible after deserialization
|
||||||
|
failures = mutableListOf()
|
||||||
|
failuresMutable = failures
|
||||||
|
}
|
||||||
|
failures.add(failure)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user