From 2e44901f4258dc23c7a412795283d54da85a0a11 Mon Sep 17 00:00:00 2001 From: Joseph Zuniga-Daly Date: Tue, 2 Jan 2024 11:36:39 +0000 Subject: [PATCH] CORE-19112: Turn off colour output in CLI under test (#214) This prevents terminal escape codes from being caputred by the test. --- .../net/corda/cli/plugins/examples/ExamplePluginTest.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/example/src/test/kotlin/net/corda/cli/plugins/examples/ExamplePluginTest.kt b/plugins/example/src/test/kotlin/net/corda/cli/plugins/examples/ExamplePluginTest.kt index 35b9604..058dc33 100644 --- a/plugins/example/src/test/kotlin/net/corda/cli/plugins/examples/ExamplePluginTest.kt +++ b/plugins/example/src/test/kotlin/net/corda/cli/plugins/examples/ExamplePluginTest.kt @@ -36,6 +36,8 @@ class ExamplePluginTest { return String(byteArrayOutputStream.toByteArray()).replace("\r\n", "\n") } + + private val colorScheme = CommandLine.Help.ColorScheme.Builder().ansi(CommandLine.Help.Ansi.OFF).build() } @Test @@ -44,9 +46,9 @@ class ExamplePluginTest { val app = ExamplePlugin.ExamplePluginEntry() val outText = tapSystemErr { - CommandLine( - app - ).execute("") + CommandLine(app) + .setColorScheme(colorScheme) + .execute("") } assertTrue(