Skip to content

Commit a68db14

Browse files
committed
简单调整JS平台的配置,仅保留 nodeJs 的测试,并改变 Timestamp.wasmJs 中的 Date 的使用方式
1 parent 3d9fdad commit a68db14

File tree

12 files changed

+62
-1529
lines changed

12 files changed

+62
-1529
lines changed

buildSrc/src/main/kotlin/JsConfig.kt

Lines changed: 13 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -21,98 +21,41 @@
2121
*
2222
*/
2323

24-
import org.gradle.api.Project
24+
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsNodeDsl
2525
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsTargetDsl
2626
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinWasmJsTargetDsl
2727

2828

2929
inline fun KotlinJsTargetDsl.configJs(
30-
nodeJs: Boolean = true,
31-
browser: Boolean = true,
30+
crossinline nodejs: KotlinJsNodeDsl.() -> Unit = {},
3231
block: () -> Unit = {}
3332
) {
34-
if (nodeJs) {
35-
nodejs {
36-
testTask {
37-
useMocha {
38-
timeout = "50000"
39-
}
40-
}
41-
}
42-
}
43-
44-
if (browser) {
45-
browser {
46-
testTask {
47-
useKarma {
48-
useChromeHeadless()
49-
}
33+
nodejs {
34+
testTask {
35+
useMocha {
36+
timeout = "30s"
5037
}
5138
}
39+
nodejs()
5240
}
5341

5442
binaries.library()
5543
block()
5644
}
5745

58-
59-
fun Project.configJsTestTasks() {
60-
// val shouldRunJsBrowserTest = !hasProperty("teamcity") || hasProperty("enable-js-tests")
61-
// if (shouldRunJsBrowserTest) return
62-
tasks.findByName("cleanJsBrowserTest")?.apply {
63-
onlyIf { false }
64-
}
65-
tasks.findByName("jsBrowserTest")?.apply {
66-
onlyIf { false }
67-
}
68-
}
69-
7046
inline fun KotlinWasmJsTargetDsl.configWasmJs(
71-
nodeJs: Boolean = true,
72-
browser: Boolean = true,
47+
crossinline nodejs: KotlinJsNodeDsl.() -> Unit = {},
7348
block: () -> Unit = {}
7449
) {
75-
if (nodeJs) {
76-
nodejs {
77-
testTask {
78-
useMocha {
79-
timeout = "50000"
80-
}
81-
}
82-
}
83-
}
84-
// if (nodeJs && isLinux) {
85-
// // win in candy node `21.0.0-v8-canary202309143a48826a08` is not supported
86-
// nodejs()
87-
// }
88-
89-
if (browser) {
90-
browser {
91-
testTask {
92-
useKarma {
93-
useChromeHeadless()
94-
}
50+
nodejs {
51+
testTask {
52+
useMocha {
53+
timeout = "30s"
9554
}
9655
}
56+
nodejs()
9757
}
9858

9959
binaries.library()
10060
block()
10161
}
102-
103-
inline fun Project.configWasmJsTest(block: () -> Unit = {}) {
104-
// if (false) {
105-
// // see https://youtrack.jetbrains.com/issue/KT-63014/Running-tests-with-wasmJs-in-1.9.20-requires-Chrome-Canary#focus=Comments-27-8321383.0-0
106-
// rootProject.the<NodeJsRootExtension>().apply {
107-
// // nodeVersion = "21.0.0-v8-canary202309143a48826a08"
108-
// version = "21.0.0-v8-canary202309143a48826a08"
109-
// downloadBaseUrl = "https://nodejs.org/download/v8-canary"
110-
// }
111-
//
112-
// tasks.withType<org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask>().configureEach {
113-
// args.add("--ignore-engines")
114-
// }
115-
// }
116-
117-
block()
118-
}

0 commit comments

Comments
 (0)