Skip to content

Commit

Permalink
Update JUnit dependencies (#4505)
Browse files Browse the repository at this point in the history
* Use consistent JUnit version in all project configurations

* Remove explicit junit-params dependency

This is already added as a dependency by useJunitJupiter()

* Remove unused Spek dependencies from projects migrated to JUnit
  • Loading branch information
3flex committed Jan 22, 2022
1 parent 2f7a925 commit 9471385
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions build-logic/src/main/kotlin/module.gradle.kts
Expand Up @@ -17,9 +17,9 @@ tasks.withType<Jar>().configureEach {
}
}

val catalogs = project.extensions.getByType(VersionCatalogsExtension::class)
val versionCatalog = project.extensions.getByType<VersionCatalogsExtension>().named("libs")

jacoco.toolVersion = catalogs.named("libs").findVersion("jacoco").get().requiredVersion
jacoco.toolVersion = versionCatalog.findVersion("jacoco").get().requiredVersion

tasks.withType<Test>().configureEach {
useJUnitPlatform()
Expand Down Expand Up @@ -96,7 +96,7 @@ tasks.withType<KotlinCompile>().configureEach {
testing {
suites {
val test by getting(JvmTestSuite::class) {
useJUnitJupiter()
useJUnitJupiter(versionCatalog.findVersion("junit").get().requiredVersion)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions custom-checks/build.gradle.kts
Expand Up @@ -5,6 +5,6 @@ plugins {
dependencies {
implementation(projects.detektApi)
testImplementation(projects.detektTest)
testImplementation(libs.bundles.testImplementation)
testRuntimeOnly(libs.spek.runner)
testImplementation(libs.assertj)
testRuntimeOnly(libs.spek.dsl)
}
3 changes: 1 addition & 2 deletions detekt-generator/build.gradle.kts
Expand Up @@ -14,8 +14,7 @@ dependencies {

testImplementation(projects.detektCore)
testImplementation(projects.detektTestUtils)
testImplementation(libs.bundles.testImplementation)
testRuntimeOnly(libs.spek.runner)
testImplementation(libs.assertj)
testImplementation(libs.reflections)
}

Expand Down
2 changes: 2 additions & 0 deletions detekt-gradle-plugin/build.gradle.kts
Expand Up @@ -39,6 +39,8 @@ testing {
}
}
register("functionalTest", JvmTestSuite::class) {
useJUnitJupiter(libs.versions.junit.get())

dependencies {
implementation(libs.assertj)
implementation(libs.spek.dsl)
Expand Down
3 changes: 1 addition & 2 deletions gradle/libs.versions.toml
Expand Up @@ -33,7 +33,6 @@ spek-dsl = { module = "org.spekframework.spek2:spek-dsl-jvm", version.ref = "spe
spek-runner = { module = "org.spekframework.spek2:spek-runner-junit5", version.ref = "spek" }

junit-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" }
junit-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit" }

sarif4k = "io.github.detekt.sarif4k:sarif4k:0.0.1"
assertj = "org.assertj:assertj-core:3.20.2"
Expand All @@ -52,4 +51,4 @@ shadow = { id = "com.github.johnrengelman.shadow", version = "7.1.2" }
sonarqube = { id = "org.sonarqube", version = "3.3" }

[bundles]
testImplementation = ["assertj", "spek-dsl", "junit-params"]
testImplementation = ["assertj", "spek-dsl"]

0 comments on commit 9471385

Please sign in to comment.