From 78f25296ad967cba3cfd5bc28a3fd4f5950f5ca0 Mon Sep 17 00:00:00 2001 From: vmishenev Date: Tue, 28 Sep 2021 18:46:49 +0300 Subject: Support JS KLib (#2159) --- .../dokka/it/gradle/JsIRGradleIntegrationTest.kt | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/JsIRGradleIntegrationTest.kt (limited to 'integration-tests/gradle/src') diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/JsIRGradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/JsIRGradleIntegrationTest.kt new file mode 100644 index 00000000..81beccee --- /dev/null +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/JsIRGradleIntegrationTest.kt @@ -0,0 +1,60 @@ +package org.jetbrains.dokka.it.gradle + +import org.gradle.testkit.runner.TaskOutcome +import org.junit.runners.Parameterized.Parameters +import java.io.File +import kotlin.test.* + +class JsIRGradleIntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() { + + companion object { + @get:JvmStatic + @get:Parameters(name = "{0}") + val versions = BuildVersions.permutations( + gradleVersions = listOf("7.2", *ifExhaustive("7.0")), + kotlinVersions = listOf("1.5.0", "1.5.30") + ) + } + + val reactVersionArg = mapOf( + "1.5.0" to "-Pdokka_it_react_kotlin_version=5.2.0-pre.202-kotlin-1.5.0", + "1.5.30" to "-Pdokka_it_react_kotlin_version=5.2.0-pre.246-kotlin-1.5.30" + ) + + @BeforeTest + fun prepareProjectFiles() { + val templateProjectDir = File("projects", "it-js-ir-0") + + templateProjectDir.listFiles().orEmpty() + .filter { it.isFile } + .filterNot { it.name == "local.properties" } + .filterNot { it.name.startsWith("gradlew") } + .forEach { topLevelFile -> topLevelFile.copyTo(File(projectDir, topLevelFile.name)) } + + File(templateProjectDir, "src").copyRecursively(File(projectDir, "src")) + } + + @Test + fun execute() { + val reactPropertyArg = reactVersionArg[versions.kotlinVersion] + ?: throw IllegalStateException("Unspecified version of react for kotlin " + versions.kotlinVersion) + val result = createGradleRunner(reactPropertyArg, "dokkaHtml", "-i", "-s").buildRelaxed() + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtml")).outcome) + + val htmlOutputDir = File(projectDir, "build/dokka/html") + assertTrue(htmlOutputDir.isDirectory, "Missing html output directory") + + assertTrue( + htmlOutputDir.allHtmlFiles().count() > 0, + "Expected html files in html output directory" + ) + + htmlOutputDir.allHtmlFiles().forEach { file -> + assertContainsNoErrorClass(file) + assertNoHrefToMissingLocalFileOrDirectory(file) + assertNoUnresolvedLinks(file) + assertNoEmptyLinks(file) + assertNoEmptySpans(file) + } + } +} \ No newline at end of file -- cgit