Skip to content

Commit b7b8f54

Browse files
committed
Updated JS tests for kotlin 2.1
1 parent b0437d4 commit b7b8f54

File tree

5 files changed

+15
-22
lines changed

5 files changed

+15
-22
lines changed

kotest-javascript/build.gradle.kts

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
2+
13
plugins {
24
alias(libs.plugins.kotlin.multiplatform)
35
alias(libs.plugins.kotest.multiplatform)
@@ -13,30 +15,21 @@ kotlin {
1315
js(IR) {
1416
nodejs()
1517
}
18+
compilerOptions {
19+
apiVersion = KotlinVersion.KOTLIN_2_1
20+
languageVersion = KotlinVersion.KOTLIN_2_1
21+
}
1622
sourceSets {
17-
val jsMain by getting {
23+
jsMain {
1824
dependencies {
1925
implementation(libs.ktor.client.js)
2026
}
2127
}
22-
val jsTest by getting {
28+
jsTest {
2329
dependencies {
2430
implementation(libs.kotest.assertions.core)
2531
implementation(libs.kotest.framework.engine)
2632
}
2733
}
2834
}
2935
}
30-
31-
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>>().configureEach {
32-
kotlinOptions {
33-
freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn"
34-
}
35-
}
36-
37-
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
38-
kotlinOptions {
39-
apiVersion = "1.9"
40-
verbose = true
41-
}
42-
}

kotest-javascript/gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[versions]
2-
kotlin = "2.0.0"
3-
kotest = "5.10.0-LOCAL"
4-
ktor = "2.3.4"
2+
kotlin = "2.1.0"
3+
kotest = "5.9.1"
4+
ktor = "2.3.7"
55

66
[libraries]
77
kotest-assertions-core = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest" }

kotest-javascript/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

kotest-javascript/src/jsMain/kotlin/http.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import io.ktor.client.statement.*
55

66
private val client = HttpClient(Js)
77

8-
suspend fun fetch(): Dog {
8+
suspend fun fetchDogUsingHttpClient(): Dog {
99
val resp = client.get("https://dog.ceo/api/breeds/image/random")
1010
var message = ""
1111
var status = ""
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package io.kotest.examples.js
22

3-
import fetch
3+
import fetchDogUsingHttpClient
44
import io.kotest.core.spec.style.FunSpec
55
import io.kotest.matchers.string.shouldEndWith
66

77
class DogTest : FunSpec({
88
test("fetching a dog using JS promises") {
9-
fetch().message.shouldEndWith(".jpg")
9+
fetchDogUsingHttpClient().message.shouldEndWith(".jpg")
1010
}
1111
})

0 commit comments

Comments
 (0)