Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions src/Microsoft.TestPlatform.Build/Tasks/VSTestTask2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,11 @@ protected override void LogEventsFromTextOutput(string singleLine, MessageImport
break;
case "output-error":
{
// Downgrade errors to info messages, xUnit outputs every assertion failure and it confuses users who see doubled error count.
// Libraries write to error output, and don't expect tests to fail.
// Logs are often written to error stream as well.
var error = data[0];
if (error != null && error.StartsWith("[xUnit.net", StringComparison.OrdinalIgnoreCase))
{
// Downgrade errors from xunit, because they will end up being duplicated on screen with assertion errors.
// And we end up with more errors in summary which is hard to figure out for users.
LogMSBuildOutputMessage(error);
}
else
{
Log.LogError(data[0]);
}
LogMSBuildOutputMessage(error);

break;
}
Expand Down Expand Up @@ -248,9 +242,14 @@ protected override void LogEventsFromTextOutput(string singleLine, MessageImport
}
}

private void LogMSBuildOutputMessage(string singleLine)
private void LogMSBuildOutputMessage(string? singleLine)
{

if (singleLine == null)
{
return;
}

var message = new ExtendedBuildMessageEventArgs("TLTESTOUTPUT", singleLine, null, null, MessageImportance.High);
BuildEngine.LogMessageEvent(message);
}
Expand Down