Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --ansi option to force Ansi output #5081

Open
powercode opened this issue Feb 19, 2025 · 1 comment
Open

Add --ansi option to force Ansi output #5081

powercode opened this issue Feb 19, 2025 · 1 comment
Labels
Area: MTP Belongs to the Microsoft.Testing.Platform core library Area: Terminal reporter

Comments

@powercode
Copy link

Summary

Add the complement to --no-ansi, that forces --ansi output, even if output is redirected.

Background and Motivation

When running the tests from a PowerShell script, I may want to display the test output but not have it as output from the PowerShell function.

mytest.exe | Out-Host
if ($LASTEXITCODE){
   throw "test failed"
}

This removes all coloring from the output, even though it's logically equivalent to passing it directly to the terminal for display.

Proposed Feature

Add --ansi parameter that forces ansi output, regardless of redirection. Let the user decide.

Alternative Designs

Always output ansi unless the user explicitly uses --no-ansi.
That has the drawback of potentially breaking existing scripts.

@Evangelink
Copy link
Member

It's probably a quick and easy update so I don't see why not! Thanks for the suggestion @powercode.

cc @mariam-abdulla as it might require some porting to dotnet test.

@Evangelink Evangelink added this to the MSTest 3.9 / MTP 1.7 milestone Feb 20, 2025
@Evangelink Evangelink added Area: MTP Belongs to the Microsoft.Testing.Platform core library Area: Terminal reporter and removed Needs: Triage 🔍 labels Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: MTP Belongs to the Microsoft.Testing.Platform core library Area: Terminal reporter
Projects
None yet
Development

No branches or pull requests

2 participants