Fix RedirectedOutputDoesNotUseAnsiSequences test failure#126243
Fix RedirectedOutputDoesNotUseAnsiSequences test failure#126243stephentoub merged 2 commits intomainfrom
Conversation
|
Tagging subscribers to this area: @dotnet/runtime-infrastructure |
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/c6b2ec4b-f010-4dc2-98e3-9c2368ef485f Co-authored-by: danmoseley <6385855+danmoseley@users.noreply.github.com>
|
@copilot keep going |
Build and tests completed successfully. All 4294 System.Console tests pass, including the fixed |
There was a problem hiding this comment.
Pull request overview
This PR addresses a flaky System.Console color test (RedirectedOutputDoesNotUseAnsiSequences) by isolating it from xUnit’s background diagnostic output, which can write to Console.Out and corrupt the test’s redirected output capture.
Changes:
- Convert the test from
[Fact]to aRemoteExecutor-gated[ConditionalFact]. - Execute the test body inside
RemoteExecutor.Invoke(...)to run it in an isolated child process.
Description
Fixes the
RedirectedOutputDoesNotUseAnsiSequencestest failure caused by xunit's background diagnostic reporter thread writing test names toConsole.Outwhile the test has it redirected to aMemoryStream, polluting the captured output.The fix wraps the test body in
RemoteExecutor.Invoke()to run it in an isolated child process where no xunit reporter thread can interfere withConsole.Out. This follows the same pattern already used by the sibling testRedirectedOutput_ColorEnvVars_RespectColorPreferencein the same file.Changes
[Fact]to[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]to gate the test onRemoteExecutoravailabilityRemoteExecutor.Invoke(static () => { ... }).Dispose()for process isolationTesting
RedirectedOutputDoesNotUseAnsiSequencestest passes reliably⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.