Skip to content

test: validate ANSI escape codes are not in redirected composer output#74

Merged
AaronFeledy merged 3 commits into
mainfrom
test/ansi-escape-codes
Feb 28, 2026
Merged

test: validate ANSI escape codes are not in redirected composer output#74
AaronFeledy merged 3 commits into
mainfrom
test/ansi-escape-codes

Conversation

@AaronFeledy
Copy link
Copy Markdown
Member

@AaronFeledy AaronFeledy commented Feb 27, 2026

Adds a test that verifies lando composer --version > file.txt does not contain ANSI escape codes in the output file.

This test is expected to FAIL on CI until the fix is applied — removing --ansi from the composer tooling command.

The root cause is --ansi being hardcoded in the composer tooling definition. Composer auto-detects TTY when --ansi isn't forced.

Ref lando/drupal#157


Note

Low Risk
Low risk: a small change to the default composer tooling command plus an example verification check; the main risk is any downstream reliance on forced ANSI formatting in composer output.

Overview
Stops forcing ANSI output for the default composer tooling by removing the hardcoded --ansi flag, so redirected output (eg lando composer --version > file) no longer contains escape codes.

Adds an example verification command to assert redirected composer output is free of ANSI escape sequences, and notes the change in the unreleased changelog.

Written by Cursor Bugbot for commit 8ad500c. This will update automatically on new commits. Configure here.

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
@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 27, 2026

Deploy Preview for lando-joomla ready!

Name Link
🔨 Latest commit 8ad500c
🔍 Latest deploy log https://app.netlify.com/projects/lando-joomla/deploys/69a234b630b64c0008b4b86e
😎 Deploy Preview https://deploy-preview-74--lando-joomla.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 86 (🔴 down 5 from production)
Accessibility: 96 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 sections breaks formatting
    • Added the missing blank line between the command on line 45 and the comment on line 47 to match the consistent formatting pattern used throughout the file.

Create PR

Or push these changes by commenting:

@cursor push 81d009f66f
Preview (81d009f66f)
diff --git a/examples/joomla-defaults/README.md b/examples/joomla-defaults/README.md
--- a/examples/joomla-defaults/README.md
+++ b/examples/joomla-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 use the correct default config files
 lando exec appserver -- cat /usr/local/etc/php/conf.d/zzz-lando-my-custom.ini | grep "; LANDOJOOMLAPHPINI"
 lando exec appserver -- curl -L http://localhost/info.php | grep max_execution_time | grep 91

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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing blank line between test sections breaks formatting

Low Severity

Every other test section in this file (and in sibling example READMEs like joomla-custom/README.md) has a blank line separating the command from the next # comment block. The new test on line 45 is immediately followed by the next section's comment on line 46 without an intervening blank line, breaking the file's consistent formatting pattern. Since leia parses these README code blocks to generate tests, inconsistent structure could affect readability or future parsing behavior.

Fix in Cursor Fix in Web

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
@AaronFeledy AaronFeledy merged commit b97d008 into main Feb 28, 2026
30 of 32 checks passed
@AaronFeledy AaronFeledy deleted the test/ansi-escape-codes branch February 28, 2026 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant