Skip to content

Commit ae1867a

Browse files
committed
Unify test execution for convenient use in IntelliJ and CLI
1 parent 3cadcc1 commit ae1867a

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

build.gradle.kts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,19 @@ tasks.withType<Test> {
8686
}
8787

8888
tasks.test {
89-
// Excludes test suites from the default test task
90-
// to avoid running some tests multiple times.
91-
filter {
92-
excludeTestsMatching("*TestSuite")
93-
}
94-
}
95-
96-
task("testTaieTestSuite", type = Test::class) {
97-
group = "verification"
98-
description = "Runs the Tai-e test suite"
99-
filter {
100-
includeTestsMatching("TaieTestSuite")
89+
doFirst {
90+
// Exclude TestSuite classes when running all tests to prevent duplicate execution
91+
// Only apply this filter when no specific test patterns are specified via command line
92+
val testFilter = filter as? org.gradle.api.internal.tasks.testing.filter.DefaultTestFilter
93+
val hasCommandLineIncludePatterns = testFilter
94+
?.commandLineIncludePatterns
95+
?.isNotEmpty()
96+
?: false
97+
if (!hasCommandLineIncludePatterns) {
98+
filter {
99+
excludeTestsMatching("*TestSuite")
100+
}
101+
}
101102
}
102103
}
103104

0 commit comments

Comments
 (0)