1+ @file:OptIn(ExperimentalWasmDsl ::class )
2+
13import com.vanniktech.maven.publish.SonatypeHost
24import fr.brouillard.oss.jgitver.Strategies
5+ import kotlin.time.Duration.Companion.seconds
6+ import kotlin.time.toJavaDuration
7+ import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
8+ import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsSubTargetDsl
39
410plugins {
511 alias(libs.plugins.kotlin.multiplatform)
@@ -28,6 +34,30 @@ kotlin {
2834
2935 jvm()
3036
37+ fun KotlinJsSubTargetDsl.configureWithKarma () {
38+ testTask {
39+ useKarma {
40+ useChromeHeadless()
41+ timeout = 60 .seconds.toJavaDuration()
42+ }
43+ }
44+ }
45+
46+ fun KotlinJsSubTargetDsl.configureWithMocha () {
47+ testTask { useMocha { timeout = " 60s" } }
48+ }
49+
50+ js(IR ) {
51+ browser { configureWithMocha() }
52+ nodejs { configureWithMocha() }
53+ }
54+
55+ wasmJs {
56+ browser { configureWithMocha() }
57+ nodejs { configureWithMocha() }
58+ d8 {}
59+ }
60+
3161 // native tier 1
3262 macosX64()
3363 macosArm64()
@@ -50,12 +80,6 @@ kotlin {
5080 mingwX64()
5181 watchosDeviceArm64()
5282
53- // native tier 3 - but no suitable Ktor engine available
54- // androidNativeArm32()
55- // androidNativeArm64()
56- // androidNativeX86()
57- // androidNativeX64()
58-
5983 applyDefaultHierarchyTemplate()
6084
6185 sourceSets {
@@ -71,6 +95,8 @@ kotlin {
7195 appleMain.dependencies { implementation(libs.ktor.client.darwin) }
7296 linuxMain.dependencies { implementation(libs.ktor.client.curl) }
7397 mingwMain.dependencies { implementation(libs.ktor.client.winhttp) }
98+ jsMain.dependencies { implementation(libs.ktor.client.js) }
99+ wasmJsMain.dependencies { implementation(libs.ktor.client.js) }
74100
75101 commonTest.dependencies {
76102 implementation(kotlin(" test" ))
0 commit comments