33 */
44package org.jetbrains.dokka.gradle
55
6- import io.kotest.assertions.withClue
76import io.kotest.core.spec.style.FunSpec
87import io.kotest.inspectors.shouldForAll
98import io.kotest.inspectors.shouldForNone
109import io.kotest.matchers.paths.shouldBeAFile
1110import io.kotest.matchers.sequences.shouldNotBeEmpty
1211import io.kotest.matchers.string.shouldContain
13- import io.kotest.matchers.string.shouldNotContainIgnoringCase
1412import org.jetbrains.dokka.gradle.internal.DokkaConstants
1513import org.jetbrains.dokka.gradle.utils.*
16- import kotlin.io.path.name
17- import kotlin.io.path.useLines
14+ import kotlin.io.path.*
1815
16+ /* *
17+ * Small reproducer for issue reported by kotlinx-io
18+ * https://github.com/Kotlin/dokka/issues/4116
19+ */
1920class KmpSharedWasmTest : FunSpec ({
2021 context("given a KMP project with a custom shared Wasm source set") {
2122 val project = initKmpSharedWasmProject()
@@ -33,22 +34,17 @@ class KmpSharedWasmTest : FunSpec({
3334 }
3435
3536 test("expect no 'unknown class' message in HTML files") {
36- val htmlFiles = project.projectDir.toFile()
37+ val htmlFiles = project.projectDir
3738 .resolve("build/dokka/html")
3839 .walk()
39- .filter { it.isFile && it.extension == " html" }
40+ .filter { it.isRegularFile() && it.extension == " html" }
4041
4142 htmlFiles.shouldNotBeEmpty()
4243
4344 htmlFiles.forEach { htmlFile ->
44- val relativePath = htmlFile.relativeTo(project.projectDir.toFile())
45- htmlFile.useLines { lines ->
46- withClue("$relativePath should not contain Error class: unknown class") {
47- lines.shouldForAll { line -> line.shouldNotContainIgnoringCase("Error class: unknown class") }
48- }
49- withClue("$relativePath should not contain ERROR CLASS : Symbol not found") {
50- lines.shouldForAll { line -> line.shouldNotContainIgnoringCase("ERROR CLASS : Symbol not found") }
51- }
45+ htmlFile.relativeTo(project.projectDir).apply {
46+ shouldNotContainText("Error class: unknown class")
47+ shouldNotContainText("ERROR CLASS : Symbol not found")
5248 }
5349 }
5450 }
@@ -79,19 +75,17 @@ private fun initKmpSharedWasmProject(
7975 """ .trimMargin()
8076
8177 buildGradleKts = """
82- |import org.jetbrains.kotlin.gradle.*
83- |
8478 |plugins {
8579 | kotlin("multiplatform") version embeddedKotlinVersion
8680 | id("org.jetbrains.dokka") version "${DokkaConstants .DOKKA_VERSION } "
8781 |}
8882 |
89- |@OptIn(ExperimentalWasmDsl::class)
83+ |@OptIn(org.jetbrains.kotlin.gradle. ExperimentalWasmDsl::class)
9084 |kotlin {
9185 | wasmJs { browser() }
9286 | wasmWasi { nodejs() }
9387 |
94- | @OptIn(ExperimentalKotlinGradlePluginApi::class)
88+ | @OptIn(org.jetbrains.kotlin.gradle. ExperimentalKotlinGradlePluginApi::class)
9589 | applyDefaultHierarchyTemplate {
9690 | common {
9791 | group("wasm") {
0 commit comments