test(features/steps): remove ansi codes
CI / lint (pull_request) Successful in 17s
CI / security (pull_request) Successful in 17s
CI / typecheck (pull_request) Successful in 24s
CI / quality (pull_request) Successful in 15s
CI / build (pull_request) Successful in 13s
CI / behave (3.13) (pull_request) Successful in 3m43s
CI / docker (pull_request) Failing after 33s
CI / helm (pull_request) Failing after 6s
CI / coverage (pull_request) Successful in 4m20s

Remove rich formatting from output
This commit is contained in:
2026-02-12 05:44:57 +00:00
parent d4a48caeec
commit c9605c9381
2 changed files with 12 additions and 4 deletions
+6 -2
View File
@@ -1085,11 +1085,15 @@ def step_impl(context):
@then("the actor command should fail with bad parameter")
def step_impl(context):
import re
assert context.result.exit_code != 0
expected = getattr(context, "expected_error", None)
if expected:
# Normalize whitespace to handle Rich text wrapping in narrow terminals
normalized = " ".join(context.result.output.split())
# Strip ANSI escape codes and normalize whitespace to handle
# Rich formatting and text wrapping in narrow CI terminals
raw = re.sub(r"\x1b\[[0-9;]*[a-zA-Z]", "", context.result.output)
normalized = " ".join(raw.split())
assert expected in normalized, f"Expected '{expected}' in output: {normalized}"
@@ -319,9 +319,13 @@ def step_assert_command_aborted(context):
@then('the output should contain "{text}"')
def step_assert_output_contains(context, text):
import re
output = _capture_output(context)
# Normalize whitespace to handle Rich text wrapping in narrow terminals
normalized = " ".join(output.split())
# Strip ANSI escape codes and normalize whitespace to handle
# Rich formatting and text wrapping in narrow CI terminals
raw = re.sub(r"\x1b\[[0-9;]*[a-zA-Z]", "", output)
normalized = " ".join(raw.split())
assert text in normalized, f"Expected to find '{text}' in CLI output: {output}"