-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathconvention.multiplatform-tests.gradle.kts
More file actions
63 lines (53 loc) · 1.94 KB
/
convention.multiplatform-tests.gradle.kts
File metadata and controls
63 lines (53 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import org.jetbrains.kotlin.gradle.plugin.KotlinTargetWithTests
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest
import org.jetbrains.kotlin.gradle.targets.wasm.nodejs.WasmNodeJsRootExtension
import tasks.KarmaReportWorkaround
plugins {
id("convention.kotlin")
id("com.google.devtools.ksp")
id("io.kotest")
}
val macOsAllTest by tasks.register("macOsAllTest") {
group = "verification"
description = "runs all tests for MacOS and IOS targets"
}
val windowsAllTest by tasks.register("windowsAllTest") {
group = "verification"
description = "runs all tests for Windows targets"
}
val linuxAllTest by tasks.register("linuxAllTest") {
group = "verification"
description = "runs all tests for Linux targets"
}
kotlin.targets.configureEach {
if (this !is KotlinTargetWithTests<*, *>) {
return@configureEach
}
when {
name.startsWith("ios") || name.startsWith("macos") -> {
macOsAllTest.dependsOn(tasks.named("${name}Test"))
}
name.startsWith("mingw") -> {
windowsAllTest.dependsOn(tasks.named("${name}Test"))
}
else -> {
linuxAllTest.dependsOn(tasks.named("${name}Test"))
}
}
}
val karmaReportWorkaround =
tasks.register<KarmaReportWorkaround>("karmaReportWorkaround") {
val nodeJsRootExtension = rootProject.extensions.getByType<NodeJsRootExtension>()
val wasmNodeJsRootExtension = rootProject.extensions.getByType<WasmNodeJsRootExtension>()
shouldRunAfter(nodeJsRootExtension.npmInstallTaskProvider, wasmNodeJsRootExtension.npmInstallTaskProvider)
}
tasks.withType<KotlinJsTest> {
when (name) {
"jsBrowserTest" -> dependsOn(karmaReportWorkaround)
// For some reasons, the output of wasmJsBrowserTest is not captured correclty
// NOTE: the reason is the same as for JS but same workaround does not work...
"wasmJsBrowserTest" -> failOnNoDiscoveredTests = false
else -> Unit
}
}