Skip to content

Commit

Permalink
feat(repo): add kotest for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
manuandru committed Feb 11, 2024
1 parent 71890eb commit 9bcbc3f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
5 changes: 5 additions & 0 deletions build-logic/src/main/kotlin/Utils.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import org.gradle.api.artifacts.MinimalExternalModuleDependency
import org.gradle.api.artifacts.VersionCatalog
import org.gradle.api.provider.Provider

fun VersionCatalog.getLibrary(name: String): Provider<MinimalExternalModuleDependency> = findLibrary(name).get()
14 changes: 14 additions & 0 deletions build-logic/src/main/kotlin/kotlin-base.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,17 @@ plugins {
ktfmt {
kotlinLangStyle()
}

val catalog = extensions.getByType<VersionCatalogsExtension>().named("libs")

dependencies {
testImplementation(catalog.getLibrary("kotest"))
}

tasks.test {
useJUnitPlatform()
}

kotlin {
jvmToolchain(17)
}
12 changes: 8 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format

[versions]
kotlin = "1.9.22"
ktfmt = "0.17.0"
detekt = "1.23.5"
ktfmt = "0.17.0"
kotest = "5.8.0"
kotlin = "1.9.22"

[libraries]
kotest = { module = "io.kotest:kotest-runner-junit5", version.ref = "kotest" }

[plugins]
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
ktfmt = { id = "com.ncorti.ktfmt.gradle", version.ref = "ktfmt" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
ktfmt = { id = "com.ncorti.ktfmt.gradle", version.ref = "ktfmt" }
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }

0 comments on commit 9bcbc3f

Please sign in to comment.