Skip to content

Commit 9dfee75

Browse files
authored
Display only failed and skipped tests by default (#298)
Passed tests are not displayed by default. Use the property `-PverboseTests=ON` to display them.
1 parent 482df53 commit 9dfee75

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
# 4 - tests
7373
- name: Check with integration
7474
if: matrix.os == 'ubuntu-latest'
75-
run: ./gradlew check -PintegrationTests=include
75+
run: ./gradlew check -PintegrationTests=include -PverboseTests=ON
7676
- name: Check without integration
7777
if: matrix.os != 'ubuntu-latest'
78-
run: ./gradlew check
78+
run: ./gradlew check -PverboseTests=ON

build.gradle.kts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,22 @@ afterEvaluate {
160160
}
161161

162162
afterEvaluate {
163-
tasks.withType<AbstractTestTask>() {
163+
tasks.withType<AbstractTestTask> {
164+
val verboseTests = project.findProperty("verboseTests") == "ON"
164165
testLogging {
165-
events("passed", "skipped", "failed", "standard_out", "standard_error")
166166
showExceptions = true
167167
showStackTraces = true
168+
if (verboseTests) {
169+
events("passed", "skipped", "failed")
170+
showStandardStreams = true
171+
} else {
172+
events("skipped", "failed")
173+
}
174+
afterSuite(KotlinClosure2({ desc: TestDescriptor, result: TestResult ->
175+
if (desc.parent == null && result.failedTestCount == 0L) {
176+
println("${result.testCount} tests completed: ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped")
177+
}
178+
}))
168179
}
169180
}
170181
tasks.withType<org.jetbrains.kotlin.gradle.targets.jvm.tasks.KotlinJvmTest> {

0 commit comments

Comments
 (0)