Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JUnit XML can contain invalid escape sequences #324

Closed
ghost opened this issue Apr 28, 2019 · 1 comment
Closed

JUnit XML can contain invalid escape sequences #324

ghost opened this issue Apr 28, 2019 · 1 comment

Comments

@ghost
Copy link

ghost commented Apr 28, 2019

Hello,

I just got through adding a test project for all of my projects in a GitLab repo. I added the JUnit test result adapter, and ran a build with a test that would be sure to fail, to ensure that I'd done everything right.

I see a message that says Test summary failed loading results, on GitLab, and upon further inspection it seems that the XML is invalid.

<?xml version="1.0" encoding="utf-8"?>
<testsuites>
  <testsuite name="Nemo.Processors.RP65816.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
    <testcase name="addressing/absolute address x, long/always fails" time="0.065">
      <failure message="&#xA;.&#xA;&#x1B;[32mexpected&#x1B;[36m: &#x1B;[32m2&#x1B;[36m&#xA;&#x1B;[31m  actual&#x1B;[36m: &#x1B;[31m1&#x1B;[36m&#xA;   at Nemo.Processors.RP65816.Tests.ModeTests.modes@137-6.Invoke(Unit unitVar) in /home/adam/Repos/nemo/Nemo.Processors.RP65816.Tests/src/ModeTests.fs:line 137&#xA;   at Expecto.Impl.execTestAsync@935-1.Invoke(Unit unitVar) in C:\Users\Anthony Lloyd\src\expecto\Expecto\Expecto.fs:line 939&#xA;   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2)&#xA;   at &lt;StartupCode$FSharp-Core&gt;.$Async.StartChild@1641-5.Invoke(AsyncActivation`1 ctxt)&#xA;   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)" />
    </testcase>
</testsuites>

As you can see, the failure element contains the character &#x1B; to encode the beginning of an ANSI escape sequence, representing color. GitLab (And other XML tools) don't recognize this as valid, it's also not part of the XML 1.0 Rev 5 spec.

There are a few solutions to this, like being able to disable colors on the console output, or stripping out such sequences before dumping to XML.

@ghost
Copy link
Author

ghost commented Apr 28, 2019

I've just found the --colours flag, waiting on confirmation that this fixes the issue.

That did the trick!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants