test: validate ANSI escape codes are not in redirected composer output#86
Conversation
Adds a test to verify that `lando composer` output does not contain ANSI escape codes when stdout is redirected to a file. This test is expected to FAIL until the fix is applied (removing `--ansi` from the composer tooling command). Ref lando/drupal#157
✅ Deploy Preview for lando-symfony ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Missing blank line between test blocks breaks separation
- Added the missing blank line after line 45 to maintain consistent formatting between test blocks as used throughout the file.
Or push these changes by commenting:
@cursor push 5711b5bfdc
Preview (5711b5bfdc)
diff --git a/examples/symfony-defaults/README.md b/examples/symfony-defaults/README.md
--- a/examples/symfony-defaults/README.md
+++ b/examples/symfony-defaults/README.md
@@ -43,6 +43,7 @@
# Should not include ANSI escape codes when output is redirected
lando composer --version > /tmp/composer-output.txt 2>&1 && ! grep -P '\x1b\[' /tmp/composer-output.txt
+
# Should report symfony requirements are met
lando symfony check:requirements| lando exec appserver -- /bin/sh -c 'NO_COLOR=1 composer -V' | grep "Composer version 2." | ||
|
|
||
| # Should not include ANSI escape codes when output is redirected | ||
| lando composer --version > /tmp/composer-output.txt 2>&1 && ! grep -P '\x1b\[' /tmp/composer-output.txt |
There was a problem hiding this comment.
Missing blank line between test blocks breaks separation
Low Severity
Every other test block in this file (and all other example READMEs like symfony-custom/README.md) has a blank line separating it from the next # Should ... comment block. The new test at line 45 is missing this blank line before line 46's # Should report symfony requirements are met. This breaks the consistent formatting pattern and could affect how leia parses these test blocks, potentially grouping two separate tests into one.
Composer auto-detects TTY and enables color output when appropriate. The --ansi flag forced ANSI escape codes even when stdout was redirected to a file or used in command substitution, breaking scripted usage. Ref lando/drupal#157




Adds a test that verifies
lando composer --version > file.txtdoes not contain ANSI escape codes in the output file.This test is expected to FAIL on CI until the fix is applied — removing
--ansifrom the composer tooling command.The root cause is
--ansibeing hardcoded in the composer tooling definition. Composer auto-detects TTY when--ansiisn't forced.Ref lando/drupal#157
Note
Low Risk
Low risk: a small change to the
composertooling command plus a docs/example verification step; main impact is howlando composerformats output when not attached to a TTY.Overview
Prevents ANSI escape codes from being emitted when
lando composeroutput is redirected by removing the hardcoded--ansifrom the Symfony recipe’scomposertooling command.Adds a defaults example verification command that asserts redirected
lando composer --versionoutput contains no ANSI sequences, and notes the change inCHANGELOG.md.Written by Cursor Bugbot for commit f20fc1e. This will update automatically on new commits. Configure here.