diff --git a/src/xunit.console/CommandLine.cs b/src/xunit.console/CommandLine.cs index ea4aadc60..438359496 100644 --- a/src/xunit.console/CommandLine.cs +++ b/src/xunit.console/CommandLine.cs @@ -170,6 +170,7 @@ protected XunitProject Parse(Predicate fileExists) { GuardNoOptionValue(option); NoColor = true; + TransformFactory.NoErrorColoring = NoColor; } else if (optionName == "noappdomain") // Here for historical reasons { diff --git a/src/xunit.console/Utility/TransformFactory.cs b/src/xunit.console/Utility/TransformFactory.cs index 0b93309a2..3eb0fd214 100644 --- a/src/xunit.console/Utility/TransformFactory.cs +++ b/src/xunit.console/Utility/TransformFactory.cs @@ -14,6 +14,8 @@ public class TransformFactory readonly Dictionary availableTransforms = new Dictionary(StringComparer.OrdinalIgnoreCase); + public static bool NoErrorColoring = false; + protected TransformFactory() { availableTransforms.Add("xml", new Transform @@ -65,9 +67,15 @@ static void Handler_DirectWrite(XElement xml, string outputFileName) static void Handler_XslTransform(string key, string resourceName, XElement xml, string outputFileName) { #if NETCOREAPP1_0 - ConsoleHelper.SetForegroundColor(ConsoleColor.Yellow); + if(!NoErrorColoring) + { + ConsoleHelper.SetForegroundColor(ConsoleColor.Yellow); + } Console.WriteLine($"Skipping -{key} because XSL-T is not supported on .NET Core 1.x"); - ConsoleHelper.ResetColor(); + if(!NoErrorColoring) + { + ConsoleHelper.ResetColor(); + } #else var xmlTransform = new System.Xml.Xsl.XslCompiledTransform();