Skip to content

Commit

Permalink
Mini tidy of test config in build files (#7032)
Browse files Browse the repository at this point in the history
* Use JUnitJupiter for all test suites

* Simplify syntax

* Remove redundant project path

* Use cleaner syntax where available
  • Loading branch information
3flex committed Mar 9, 2024
1 parent 8e952c8 commit 9403c84
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
3 changes: 1 addition & 2 deletions build-logic/src/main/kotlin/module.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ val versionCatalog = versionCatalogs.named("libs")
jacoco.toolVersion = versionCatalog.findVersion("jacoco").get().requiredVersion

tasks.withType<Test>().configureEach {
useJUnitPlatform()
maxParallelForks = if (providers.environmentVariable("CI").isPresent) {
Runtime.getRuntime().availableProcessors()
} else {
Expand Down Expand Up @@ -68,7 +67,7 @@ project.tasks.withType<UsesKotlinJavaToolchain>().configureEach {

testing {
suites {
getByName("test", JvmTestSuite::class) {
withType<JvmTestSuite> {
useJUnitJupiter(versionCatalog.findVersion("junit").get().requiredVersion)
}
}
Expand Down
7 changes: 3 additions & 4 deletions code-coverage-report/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ reporting {
reports {
create("jacocoMergedReport", JacocoCoverageReport::class) {
testType = TestSuiteType.UNIT_TEST
reportTask {
dependsOn(":detekt-generator:generateDocumentation")
}
}
}
}
Expand Down Expand Up @@ -42,7 +45,3 @@ dependencies {
jacocoAggregation(projects.detektTooling)
jacocoAggregation(projects.detektUtils)
}

tasks.withType<JacocoReport>().configureEach {
dependsOn(":detekt-generator:generateDocumentation")
}
2 changes: 1 addition & 1 deletion detekt-cli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ tasks {

processTestResources {
inputs.property("kotlin-version", libs.versions.kotlin.get())
filter(ReplaceTokens::class, "tokens" to mapOf("kotlinVersion" to inputs.properties["kotlin-version"]))
filter<ReplaceTokens>("tokens" to mapOf("kotlinVersion" to inputs.properties["kotlin-version"]))
filteringCharset = "UTF-8"
}

Expand Down
6 changes: 2 additions & 4 deletions detekt-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,10 @@ testing {
implementation(gradleKotlinDsl())
}
}
register("functionalTest", JvmTestSuite::class) {
useJUnitJupiter(libs.versions.junit.get())

register<JvmTestSuite>("functionalTest") {
dependencies {
implementation(libs.assertj)
implementation(testFixtures(project(":")))
implementation(testFixtures(project()))
}

targets {
Expand Down

0 comments on commit 9403c84

Please sign in to comment.