From d848bec14f67fa944ee34a6d918f0440ebbe5962 Mon Sep 17 00:00:00 2001 From: Victor Rubezhny Date: Fri, 30 Jan 2026 13:36:01 +0100 Subject: [PATCH] fix: Add tests execution reporting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The PR adds the tests execution report to the output, like: ``` =============================== Test summary: Total: 168 Passed: 168 Failed: 0 Skipped: 0 =============================== ``` Also the `-PshowPassed` option is added to enable all the PASSED tests to be listed: ``` ℹ️ Passed test output is hidden. Re-run with -PshowPassed to include PASSED tests in the output. ``` Signed-off-by: Victor Rubezhny Assisted-by: OpenAI ChatGPT --- build.gradle.kts | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 75bc075..a2818e3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,9 @@ import org.jetbrains.changelog.Changelog import org.jetbrains.changelog.markdownToHTML import org.jetbrains.intellij.platform.gradle.TestFrameworkType +import org.gradle.api.tasks.testing.TestDescriptor +import org.gradle.api.tasks.testing.TestResult +import org.gradle.kotlin.dsl.KotlinClosure2 plugins { id("java") // Java support @@ -172,12 +175,44 @@ tasks { ) testLogging { // Exclude standardError, standardOut - events("skipped", "failed") + val showPassed = providers.gradleProperty("showPassed").isPresent + if (!showPassed) { + println( + """ + ℹ️ Passed test output is hidden. + Re-run with -PshowPassed to include PASSED tests in the output. + """.trimIndent() + ) + } + + events( + "failed", + "skipped", + *if (showPassed) arrayOf("passed") else emptyArray() // Use''-PshowPassed' option to see PASSED tests in output + ) + exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL showExceptions = true showCauses = true showStackTraces = true } + afterSuite( + KotlinClosure2({ desc, result -> + if (desc.parent == null) { + println( + """ + =============================== + Test summary: + Total: ${result.testCount} + Passed: ${result.successfulTestCount} + Failed: ${result.failedTestCount} + Skipped: ${result.skippedTestCount} + =============================== + """.trimIndent() + ) + } + }) + ) } }