Skip to content

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

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

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

Conversation

@AaronFeledy
Copy link
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 a verification check; main impact is slightly different terminal formatting for interactive usage.

Overview
Stops forcing ANSI formatting in the Acquia recipe’s composer tooling by removing the hardcoded --ansi flag, so redirected output doesn’t contain escape codes.

Adds an example verification step to assert lando composer --version redirected to a file contains no ANSI escapes, and documents the change in CHANGELOG.md.

Written by Cursor Bugbot for commit 2194e4c. 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

netlify bot commented Feb 27, 2026

Deploy Preview for lando-acquia ready!

Name Link
🔨 Latest commit 2194e4c
🔍 Latest deploy log https://app.netlify.com/projects/lando-acquia/deploys/69a234bca66aed00086055c2
😎 Deploy Preview https://deploy-preview-163--lando-acquia.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: 84 (🔴 down 8 from production)
Accessibility: 98 (no change from production)
Best Practices: 100 (no change from production)
SEO: 92 (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

@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 cd drupal9 before lando composer test command
    • Added the missing cd drupal9 line before the lando composer --version command to match the pattern used in all other test blocks.

Create PR

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

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

Aaron Feledy 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
@AaronFeledy AaronFeledy merged commit 344b028 into main Feb 28, 2026
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