Skip to content

Commit 713aed7

Browse files
committed
Setup for Kotest 6
1 parent 0e79823 commit 713aed7

File tree

11 files changed

+81
-71
lines changed

11 files changed

+81
-71
lines changed

kotest-javascript/build.gradle.kts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,29 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
33
plugins {
44
alias(libs.plugins.kotlin.multiplatform)
55
alias(libs.plugins.kotest)
6-
alias(libs.plugins.kotest.multiplatform)
6+
id("com.google.devtools.ksp") version "2.2.0-2.0.2"
77
}
88

99
repositories {
1010
mavenLocal()
1111
mavenCentral()
1212
}
1313

14+
kotest {
15+
failOnNoTests = true
16+
}
17+
1418
kotlin {
19+
20+
compilerOptions {
21+
apiVersion = KotlinVersion.KOTLIN_2_2
22+
languageVersion = KotlinVersion.KOTLIN_2_2
23+
}
24+
1525
js {
1626
nodejs()
1727
}
18-
compilerOptions {
19-
apiVersion = KotlinVersion.KOTLIN_2_1
20-
languageVersion = KotlinVersion.KOTLIN_2_1
21-
}
28+
2229
sourceSets {
2330
commonTest {
2431
dependencies {
@@ -28,11 +35,15 @@ kotlin {
2835
}
2936
jsMain {
3037
dependencies {
31-
kotlin("stdlib-js")
38+
api(kotlin("stdlib-js"))
3239
implementation(libs.ktor.client.js)
3340
// needed as a workaround for https://youtrack.jetbrains.com/issue/KT-57235
3441
implementation("org.jetbrains.kotlin:kotlinx-atomicfu-runtime:2.1.10")
3542
}
3643
}
3744
}
3845
}
46+
47+
dependencies {
48+
add("kspJsTest", libs.kotest.framework.symbol.processor)
49+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
[versions]
2-
kotlin = "2.1.20"
2+
kotlin = "2.2.0"
33
kotest = "6.0.0-LOCAL"
44
ktor = "3.0.1"
55

66
[libraries]
77
kotest-assertions-core = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest" }
88
kotest-framework-engine = { module = "io.kotest:kotest-framework-engine", version.ref = "kotest" }
9+
kotest-framework-symbol-processor = { module = "io.kotest:kotest-framework-symbol-processor", version.ref = "kotest" }
910

1011
ktor-client-js = { module = "io.ktor:ktor-client-js", version.ref = "ktor" }
1112

1213
[plugins]
1314
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
14-
kotest-multiplatform = { id = "io.kotest.multiplatform", version.ref = "kotest" }
1515
kotest = { id = "io.kotest", 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.12.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package io.kotest.examples.js
2+
3+
import io.kotest.core.spec.style.FunSpec
4+
import kotlinx.coroutines.delay
5+
6+
class CoroutinesTest : FunSpec({
7+
8+
context("js now allows nested tests") {
9+
delay(100) // look ma, I can use coroutines here!
10+
context("give me another context!") {
11+
delay(200) // look ma, I can use coroutines here!
12+
test("a leaf test") {
13+
delay(300) // look ma, I can use coroutines here!
14+
}
15+
}
16+
}
17+
})

kotest-javascript/src/jsTest/kotlin/io/kotest/examples/js/dog/DogTest.kt renamed to kotest-javascript/src/jsTest/kotlin/io/kotest/examples/js/DogTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.kotest.examples.js.dog
1+
package io.kotest.examples.js
22

33
import fetchDogUsingHttpClient
44
import io.kotest.core.spec.style.FunSpec

kotest-javascript/src/jsTest/kotlin/io/kotest/examples/js/ssn/SsnTest.kt renamed to kotest-javascript/src/jsTest/kotlin/io/kotest/examples/js/SsnTest.kt

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
1-
package io.kotest.examples.js.ssn
1+
package io.kotest.examples.js
22

33
import io.kotest.core.spec.style.FunSpec
44
import io.kotest.matchers.shouldBe
5-
import kotlinx.coroutines.delay
65
import validateSocial
76

87
class SsnTest : FunSpec({
98

10-
context("js now allows nested tests") {
11-
delay(1000) // look ma, I can use coroutines here !
12-
context("give me another context!") {
13-
delay(1000) // look ma, I can use coroutines here !
14-
test("a SSN should be invalid when it contains a zero in any position") {
15-
delay(1000) // look ma, I can use coroutines here too !
16-
validateSocial("543-23-5013") shouldBe false
17-
validateSocial("043-23-5313") shouldBe false
18-
validateSocial("313-03-5310") shouldBe false
19-
}
20-
}
9+
test("a SSN should be invalid when it contains a zero in any position") {
10+
validateSocial("543-23-5013") shouldBe false
11+
validateSocial("043-23-5313") shouldBe false
12+
validateSocial("313-03-5310") shouldBe false
2113
}
2214

2315
test("a SSN should be invalid when it starts with 666") {

kotest-native/build.gradle.kts

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
buildscript {
2-
repositories {
3-
mavenCentral()
4-
mavenLocal()
5-
}
6-
}
1+
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
72

83
plugins {
94
alias(libs.plugins.kotlin.multiplatform)
5+
id("com.google.devtools.ksp") version "2.2.0-2.0.2"
106
}
117

128
repositories {
@@ -16,32 +12,16 @@ repositories {
1612

1713
kotlin {
1814

19-
targets {
20-
linuxX64 {
21-
binaries {
22-
executable()
23-
}
24-
}
25-
linuxArm64()
26-
27-
mingwX64()
28-
29-
macosX64()
30-
macosArm64()
31-
32-
tvosX64()
33-
tvosArm64()
34-
tvosSimulatorArm64()
35-
36-
watchosArm64()
37-
watchosX64()
38-
watchosSimulatorArm64()
39-
40-
iosX64()
41-
iosArm64()
42-
iosSimulatorArm64()
15+
compilerOptions {
16+
apiVersion = KotlinVersion.KOTLIN_2_2
17+
languageVersion = KotlinVersion.KOTLIN_2_2
4318
}
4419

20+
linuxX64()
21+
mingwX64()
22+
macosX64()
23+
iosX64()
24+
4525
sourceSets {
4626

4727
nativeTest {
@@ -53,3 +33,10 @@ kotlin {
5333
}
5434
}
5535
}
36+
37+
dependencies {
38+
add("kspLinuxX64Test", libs.kotest.framework.symbol.processor)
39+
add("kspMingwX64Test", libs.kotest.framework.symbol.processor)
40+
add("kspMacosX64Test", libs.kotest.framework.symbol.processor)
41+
add("kspIosX64Test", libs.kotest.framework.symbol.processor)
42+
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[versions]
2-
kotest = "5.9.1"
3-
kotlin = "2.1.21"
2+
kotest = "6.0.0-LOCAL"
3+
kotlin = "2.2.0"
44

55
[libraries]
66
kotest-framework-engine = { module = "io.kotest:kotest-framework-engine", version.ref = "kotest" }
7+
kotest-framework-symbol-processor = { module = "io.kotest:kotest-framework-symbol-processor", version.ref = "kotest" }
78

89
[plugins]
9-
kotest-multiplatform = { id = "io.kotest.multiplatform", version.ref = "kotest" }
1010
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }

kotest-native/src/nativeTest/kotlin/io/kotest/examples/native/BitstringTest.kt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ import io.kotest.assertions.throwables.shouldThrowAny
44
import io.kotest.core.spec.style.DescribeSpec
55
import io.kotest.matchers.shouldBe
66

7-
class BitstringTest : DescribeSpec() {
8-
init {
9-
describe("bit strings") {
10-
it("should set bits based on booleans 1") {
11-
bitstring(listOf(true, false, true, false, true)) shouldBe "10101"
12-
bitstring(listOf(false, false, false, false, false, false, false, true)) shouldBe "00000001"
13-
}
14-
it("should error on empty") {
15-
shouldThrowAny {
16-
bitstring(listOf())
17-
}
18-
}
19-
}
20-
}
21-
}
7+
//class BitstringTest : DescribeSpec() {
8+
// init {
9+
// describe("bit strings") {
10+
// it("should set bits based on booleans 1") {
11+
// bitstring(listOf(true, false, true, false, true)) shouldBe "10101"
12+
// bitstring(listOf(false, false, false, false, false, false, false, true)) shouldBe "00000001"
13+
// }
14+
// it("should error on empty") {
15+
// shouldThrowAny {
16+
// bitstring(listOf())
17+
// }
18+
// }
19+
// }
20+
// }
21+
//}

kotest-native/src/nativeTest/kotlin/io/kotest/examples/native/SsnTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package io.kotest.examples.native
22

33
import io.kotest.core.spec.style.FunSpec
44
import io.kotest.matchers.shouldBe
5+
import kotlinx.coroutines.delay
56

67
class SsnTest : FunSpec() {
78
init {
@@ -17,6 +18,7 @@ class SsnTest : FunSpec() {
1718
}
1819

1920
test("ssn should be in the accepted format") {
21+
delay(22)
2022
validateSocial("") shouldBe false
2123
validateSocial("123-45-678") shouldBe false
2224
validateSocial("12-45-6789") shouldBe false

0 commit comments

Comments
 (0)