Skip to content

Commit

Permalink
Fix displaying progress in non-ansi terminal (microsoft#4320)
Browse files Browse the repository at this point in the history
  • Loading branch information
Evangelink authored Dec 11, 2024
1 parent 23321d7 commit 88286f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,6 @@ public void RenderProgress(TestProgressState?[] progress)

// Use just ascii here, so we don't put too many restrictions on fonts needing to
// properly show unicode, or logs being saved in particular encoding.
TestDetailState? activeTest = p.TestNodeResultsState?.GetFirstRunningTask();
string? detail = !RoslynString.IsNullOrWhiteSpace(activeTest?.Text) ? $"- {activeTest.Text}" : null;
Append('[');
SetColor(TerminalColor.DarkGreen);
Append('+');
Expand Down Expand Up @@ -226,10 +224,12 @@ public void RenderProgress(TestProgressState?[] progress)
Append(')');
}

if (!RoslynString.IsNullOrWhiteSpace(detail))
TestDetailState? activeTest = p.TestNodeResultsState?.GetRunningTasks(1).FirstOrDefault();
if (!RoslynString.IsNullOrWhiteSpace(activeTest?.Text))
{
Append(" - ");
Append(detail);
Append(activeTest.Text);
Append(' ');
}

Append(durationString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ public TestNodeResultsState(long id)

public void RemoveRunningTestNode(string uid) => _testNodeProgressStates.TryRemove(uid, out _);

public TestDetailState? GetFirstRunningTask() => _testNodeProgressStates.FirstOrDefault().Value;

public IEnumerable<TestDetailState> GetRunningTasks(int maxCount)
{
var sortedDetails = _testNodeProgressStates
Expand Down

0 comments on commit 88286f6

Please sign in to comment.