Skip to content

Comments

Refactor ANSI handling for better readability#52525

Merged
Youssef1313 merged 1 commit intomainfrom
dev/ygerges/simplify-ansi
Jan 19, 2026
Merged

Refactor ANSI handling for better readability#52525
Youssef1313 merged 1 commit intomainfrom
dev/ygerges/simplify-ansi

Conversation

@Youssef1313
Copy link
Member

Copilot AI review requested due to automatic review settings January 17, 2026 03:47
@Youssef1313 Youssef1313 requested a review from a team as a code owner January 17, 2026 03:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors ANSI handling in the terminal test reporter by replacing two boolean flags (UseAnsi and UseCIAnsi) with a single, more expressive AnsiMode enum. This change improves code readability and maintainability by making the different ANSI modes explicit.

Changes:

  • Introduced AnsiMode enum with four values: NoAnsi, SimpleAnsi, AnsiIfPossible, and ForceAnsi
  • Replaced boolean properties UseAnsi and UseCIAnsi in TerminalTestReporterOptions with AnsiMode property
  • Updated TerminalTestReporter constructor to use the new enum for clearer logic flow
  • Modified MicrosoftTestingPlatformTestCommand to map command-line flags and CI detection to appropriate AnsiMode values

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/Cli/dotnet/Commands/Test/MTP/Terminal/TerminalTestReporterOptions.cs Replaced boolean properties with AnsiMode enum; added well-documented AnsiMode enum with four values
src/Cli/dotnet/Commands/Test/MTP/Terminal/TerminalTestReporter.cs Refactored constructor logic to use AnsiMode enum instead of booleans; simplified branching logic
src/Cli/dotnet/Commands/Test/MTP/MicrosoftTestingPlatformTestCommand.cs Updated initialization logic to map --no-ansi flag and CI detection to AnsiMode values

@Youssef1313 Youssef1313 force-pushed the dev/ygerges/simplify-ansi branch from 09aacbf to 0267f6d Compare January 17, 2026 04:03
@Youssef1313 Youssef1313 merged commit 7b83281 into main Jan 19, 2026
26 checks passed
@Youssef1313 Youssef1313 deleted the dev/ygerges/simplify-ansi branch January 19, 2026 12:26
@Youssef1313
Copy link
Member Author

/backport to release/10.0.2xx

@github-actions
Copy link
Contributor

Started backporting to release/10.0.2xx (link to workflow run)

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.

2 participants