Skip to content

Commit

Permalink
Ensure we don't use ANSI color codes in MSpec tests
Browse files Browse the repository at this point in the history
MSpec outputs the results to HTML/XML and 0x1B is not a valid character
  • Loading branch information
csmager committed Mar 13, 2017
1 parent 85f8879 commit 5b54d75
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/test/Test.FAKECore/FSIHelperSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
using Fake;
using Machine.Specifications;
using Messages = Microsoft.FSharp.Collections.FSharpList<Fake.ProcessHelper.ConsoleMessage>;
Expand Down Expand Up @@ -121,6 +122,21 @@ static FSIHelper.Script script(string path, string contents)
return new FSIHelper.Script(contents, path.Replace("\\", "/"), null, null);
}

private Establish context = () =>
{
var consoleListener = TraceListener.defaultConsoleTraceListener;

if (consoleListener.useAnsiColorCodes)
{
TraceListener.listeners.Remove(consoleListener);
TraceListener.listeners.Add(
new TraceListener.ConsoleTraceListener(
consoleListener.importantMessagesToStdErr,
consoleListener.colorMap,
useAnsiColorCodes: false));
}
};

It fallback_should_not_trigger_when_attribute_constructor_throws =
() =>
{
Expand Down

0 comments on commit 5b54d75

Please sign in to comment.