-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
🐛 Bug: xunit reporter does not strip ansi escape sequences, leading to invalid XML #4526
Comments
Some additional info: https://www.w3.org/TR/xml/#charsets
|
Should we remove |
I just found your PR. I will check it. |
How about replacing he.encode(String(html), {useNamedReferences: false}) with the following as escXML(String(html))?
This would preserve the original data (except for bad unicode sequences) and be a more general solution. |
I'm happy to incorporate this into #4527 (which has been auto-closed, unfortunately) |
I was running into issues with this with failures reported by Under the hood, |
Prerequisites
faq
labelnode node_modules/.bin/mocha --version
(Local) andmocha --version
(Global). We recommend that you not install Mocha globally.Description
When testing code that is throwing exceptions that have strings formatted with
chalk
or using ANSI escape codes in some other way, the resulting XML will contain the entity reference&x1B;
which is an invalid character in XML.Steps to Reproduce
Prepare minimal test file
Run tests using mocha and xunit reporter
Test fails as expected and creates
xunit.xml
Validate XML
Expected behavior:
xunit.xml
contains valid XMLActual behavior: the XML contains the invalid character

Reproduces how often: 100%
Versions
mocha --version
andnode node_modules/.bin/mocha --version
: 8.2.1node --version
: v10.22.0The text was updated successfully, but these errors were encountered: