Skip to content

Conversation

@snellingio
Copy link
Collaborator

@snellingio snellingio commented Aug 7, 2025

What:

  • Bug Fix
  • New Feature

Description:

See the 3.x PR #1430

Fixes issue where --colors=never option was being disregarded when using --parallel flag.

Problem:
When running tests with both --parallel and --colors=never options, ANSI color codes were still being output, inconsistent with non-parallel mode behavior.

Root Cause:
The issue occurred in three places:

  1. Worker processes (bin/worker.php): Were hardcoded to use decorated output (true)
  2. Main parallel process (src/Plugins/Parallel.php): Was not passing decoration setting to CleanConsoleOutput
  3. Progress printer (CompactPrinter): Was hardcoded to use decorated output

Solution:

  • Modified worker processes to respect the --colors parameter from command line arguments
  • Updated main parallel process to check --colors option and pass decoration setting to output
  • Added CompactPrinter::create() method to accept decoration parameter and updated ResultPrinter to use it

Testing:

  • Added test case to verify --colors=never works correctly in parallel mode
  • Verified existing functionality still works
  • Manual testing confirms ANSI codes are properly suppressed when --colors=never is used with --parallel
# This should show NO ANSI color codes
vendor/bin/pest --parallel --colors=never

# This should show ANSI color codes (default behavior)  
vendor/bin/pest --parallel --colors=always

Related:

Closes #1258

The parallel mode was ignoring the --colors=never flag, causing ANSI
color codes to appear even when colors were explicitly disabled. This
affected multiple components of the parallel execution system.

Changes:
- Fixed bin/worker.php to respect --colors option from command line
- Updated main parallel process to pass decoration setting to output
- Modified CompactPrinter to accept decoration parameter
- Updated ResultPrinter to use output decoration setting
- Added test to verify --colors=never works in parallel mode

Fixes parallel mode color handling inconsistency where --colors=never
was ignored, ensuring clean output when colors are disabled.
@snellingio snellingio changed the base branch from 3.x to 4.x August 7, 2025 23:11
@snellingio snellingio changed the title fix: respect --colors=never option in parallel mode [4.x] fix: respect --colors=never option in parallel mode Aug 7, 2025
@snellingio
Copy link
Collaborator Author

Closing these out since there isn't much interest in fixing.

@snellingio snellingio closed this Aug 21, 2025
@nunomaduro nunomaduro reopened this Aug 21, 2025
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.

[Bug]: --parallel ignores or changes other commandline arguments

2 participants