test: validate ANSI escape codes are not in redirected composer output#163
Merged
AaronFeledy merged 3 commits intomainfrom Feb 28, 2026
Merged
test: validate ANSI escape codes are not in redirected composer output#163AaronFeledy merged 3 commits intomainfrom
AaronFeledy merged 3 commits intomainfrom
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-acquia 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
cd drupal9beforelando composertest command- Added the missing
cd drupal9line before thelando composer --versioncommand to match the pattern used in all other test blocks.
- Added the missing
Or push these changes by commenting:
@cursor push 604f52c6a5
Preview (604f52c6a5)
diff --git a/examples/drupal/README.md b/examples/drupal/README.md
--- a/examples/drupal/README.md
+++ b/examples/drupal/README.md
@@ -57,6 +57,7 @@
lando composer --version | grep Composer | grep 2.
# Should not include ANSI escape codes when output is redirected
+cd drupal9
lando composer --version > /tmp/composer-output.txt 2>&1 && ! grep -P '\x1b\[' /tmp/composer-output.txt
# Should be able to specify the composer version
cd drupal9| lando composer --version | grep Composer | grep 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 cd drupal9 before lando composer test command
High Severity
The new test block is missing the cd drupal9 line that every other Leia test block in this file has before running lando commands. Leia resets the working directory to the test root (examples/drupal/) for each #-comment block, so lando composer will run outside the project directory where no .lando.yml exists, causing the command to fail regardless of whether ANSI codes are present.
added 2 commits
February 27, 2026 18:18
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




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 default
composertooling command plus a verification check; main impact is slightly different terminal formatting for interactive usage.Overview
Stops forcing ANSI formatting in the Acquia recipe’s
composertooling by removing the hardcoded--ansiflag, so redirected output doesn’t contain escape codes.Adds an example verification step to assert
lando composer --versionredirected to a file contains no ANSI escapes, and documents the change inCHANGELOG.md.Written by Cursor Bugbot for commit 2194e4c. This will update automatically on new commits. Configure here.