From 9e15f07aefe6ea1f366466c6721b92e77e3f1b41 Mon Sep 17 00:00:00 2001 From: Marcin Aman Date: Tue, 22 Jun 2021 15:17:55 +0200 Subject: Logging in CLI (#1976) --- .../jetbrains/dokka/it/cli/CliIntegrationTest.kt | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'integration-tests/cli/src') diff --git a/integration-tests/cli/src/integrationTest/kotlin/org/jetbrains/dokka/it/cli/CliIntegrationTest.kt b/integration-tests/cli/src/integrationTest/kotlin/org/jetbrains/dokka/it/cli/CliIntegrationTest.kt index 05ef667a..8935f8f5 100644 --- a/integration-tests/cli/src/integrationTest/kotlin/org/jetbrains/dokka/it/cli/CliIntegrationTest.kt +++ b/integration-tests/cli/src/integrationTest/kotlin/org/jetbrains/dokka/it/cli/CliIntegrationTest.kt @@ -155,6 +155,7 @@ class CliIntegrationTest : AbstractCliIntegrationTest() { val process = ProcessBuilder( "java", "-jar", cliJarFile.path, "-outputDir", dokkaOutputDir.path, + "-loggingLevel", "DEBUG", "-pluginsClasspath", basePluginJarFile.path, "-sourceSet", buildString { @@ -166,6 +167,7 @@ class CliIntegrationTest : AbstractCliIntegrationTest() { val result = process.awaitProcessResult() assertEquals(0, result.exitCode, "Expected exitCode 0 (Success)") + assertTrue(result.output.contains("Loaded plugins: "), "Expected output to not contain info logs") assertTrue(dokkaOutputDir.isDirectory, "Missing dokka output directory") @@ -181,4 +183,26 @@ class CliIntegrationTest : AbstractCliIntegrationTest() { val navigationHtml = File(dokkaOutputDir, "navigation.html") assertTrue(navigationHtml.isFile, "Missing navigation.html") } + + @Test + fun `logging level should be respected`(){ + val dokkaOutputDir = File(projectDir, "output") + assertTrue(dokkaOutputDir.mkdirs()) + val process = ProcessBuilder( + "java", "-jar", cliJarFile.path, + "-outputDir", dokkaOutputDir.path, + "-loggingLevel", "WARN", + "-pluginsClasspath", basePluginJarFile.path, + "-sourceSet", + buildString { + append(" -src ${File(projectDir, "src").path}") + } + ) + .redirectErrorStream(true) + .start() + + val result = process.awaitProcessResult() + assertEquals(0, result.exitCode, "Expected exitCode 0 (Success)") + assertFalse(result.output.contains("Loaded plugins: "), "Expected output to not contain info logs") + } } -- cgit