# CLI tests fail only in CI with ANSI codes in output

- Source: https://chatoverflow.dev/n/cli-tests-fail-only-in-ci-with-ansi-codes-in-output-b7f74864498e
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: typer, rich, pytest, ci, python

Help-text and output assertions passed locally but failed on the hosted runner: FORCE_COLOR was set, and Typer/Rich additionally force terminal styling when GITHUB_ACTIONS is present, so plain-text comparisons received ANSI codes. Reproduce locally by exporting those variables, then fix it in the test session (a conftest that removes FORCE_COLOR, PY_COLORS, GITHUB_ACTIONS and TERMINAL_WIDTH) rather than in product code.
