Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Kotlin version override in tests #1154

Merged
merged 3 commits into from Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 0 additions & 10 deletions buildSrc/src/main/kotlin/buildsrc/config/Deps.kt
Expand Up @@ -15,7 +15,6 @@ object Deps {
const val slfj = "2.0.5"
const val logback = "1.4.5"
const val junitJupiter = "5.8.2"
const val junitVintage = "5.8.2"
const val junit4 = "4.13.2"

const val byteBuddy = "1.14.6"
Expand All @@ -37,17 +36,8 @@ object Deps {
const val slfj = "org.slf4j:slf4j-api:${Versions.slfj}"
const val logback = "ch.qos.logback:logback-classic:${Versions.logback}"

const val kotlinBom = "org.jetbrains.kotlin:kotlin-bom:${Versions.kotlinDefault}"
const val kotlinReflect = "org.jetbrains.kotlin:kotlin-reflect"

const val junit4 = "junit:junit:${Versions.junit4}"
const val junitJupiter = "org.junit.jupiter:junit-jupiter:${Versions.junitJupiter}"
const val junitJupiterApi = "org.junit.jupiter:junit-jupiter-api:${Versions.junitJupiter}"
const val junitJupiterEngine = "org.junit.jupiter:junit-jupiter-engine:${Versions.junitJupiter}"
const val junitVintageEngine = "org.junit.vintage:junit-vintage-engine:${Versions.junitJupiter}"

const val kotlinTest = "org.jetbrains.kotlin:kotlin-test:${Versions.kotlinDefault}"
const val kotlinTestJunit5 = "org.jetbrains.kotlin:kotlin-test-junit5:${Versions.kotlinDefault}"

const val kotlinCoroutinesBom = "org.jetbrains.kotlinx:kotlinx-coroutines-bom:${Versions.coroutines}"
const val kotlinCoroutinesCore = "org.jetbrains.kotlinx:kotlinx-coroutines-core"
Expand Down
11 changes: 9 additions & 2 deletions test-modules/client-tests/build.gradle.kts
@@ -1,3 +1,5 @@
import buildsrc.config.kotlinVersion

plugins {
buildsrc.convention.`kotlin-multiplatform`
}
Expand All @@ -10,10 +12,10 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(dependencies.platform(kotlin("bom")))
implementation(enforcedPlatform(kotlin("bom", version = kotlinVersion())))
implementation(kotlin("reflect"))

implementation(dependencies.platform(buildsrc.config.Deps.Libs.kotlinCoroutinesBom))
implementation(platform(buildsrc.config.Deps.Libs.kotlinCoroutinesBom))
implementation(buildsrc.config.Deps.Libs.kotlinCoroutinesCore)
}
}
Expand Down Expand Up @@ -41,3 +43,8 @@ kotlin {
}
}
}

tasks.withType<Test> {
// Forward the expected Kotlin version to unit tests
environment("kotlin.version", kotlinVersion())
}
@@ -0,0 +1,14 @@
package io.mockk.test

import kotlin.test.Test
import kotlin.test.assertEquals

class KotlinVersionOverrideTest {

@Test
fun `ensure Kotlin version is correctly handled`() = assertEquals(
actual = System.getenv("kotlin.version").orEmpty(),
expected = KotlinVersion.CURRENT.toString(),
)

}