-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
When the error message or stack contains any non-safe characters, it breaks the xunit file and the resulting report is no longer valid XML.
Repro:
# Explicit:
npm init --yes
npm i -D mocha
echo "it('throws', () => { throw new Error('\x1B[32mfoo\x1B[0m'); })">test.js
./node_modules/.bin/mocha -R xunit -O output=report.xml test.js
# One-liner:
npm init --yes >/dev/null && npm i -D mocha >/dev/null && echo "it('throws', () => { throw new Error('\x1B[32mfoo\x1B[0m'); })">test.js && ./node_modules/.bin/mocha -R xunit -O output=report.xml test.js
Running report.xml
through an online validator will trigger messages like the following:
An invalid XML character (Unicode: 0x1b) was found in the element content of the document.
Metadata
Metadata
Assignees
Labels
No labels