-
-
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
fix: remove ansi escape sequences from escaped xunit output #4527
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't there a way to escape or remove all invalid characters for XML?
There is a related |
This PR hasn't had any recent activity, and I'm labeling it |
This issue has been hanging around for 8 months now, and I'm unsure what I can do to get it moving again. There is an open thread that has multiple possible solutions to the problem, but no expression of preference from the Mocha team. |
Hi @JoshuaKGoldberg – that's unexpected – but not unwelcome. I'm happy to rebase the PR to the latest |
Great! Let's go ahead and reopen this one. We also discussed that we don't like the requirement of rebasing, so if you want to do a more casual merge that works too. Whatever's easiest on your end. 🙂 |
Ok, let me get that CLA signed, then. |
|
@JoshuaKGoldberg can I get some eyes on this, please? |
Yes! Thanks for the prod - this slipped off my radar. Reviewing now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Swell! A nice direct change, with a test case - thank you! 🙌
Will wait for another maintainer to review. In the interim, just leaving one small nitpick, nothing particularly important.
@@ -62,6 +62,32 @@ describe('reporters', function () { | |||
done(err); | |||
}); | |||
}); | |||
|
|||
it('does not include ansi escape sequences (issue: 4526)', function(done) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Naming] Nit: behaviors and tests have a habit of morphing over time...
it('does not include ansi escape sequences (issue: 4526)', function(done) { | |
it('does not include ansi escape sequences', function(done) { |
(context: I think there are only two examples of a test name including something like this, from 3 someone who isn't maintaining anymore, 3 years ago - if this ever was a Mocha practice, it wasn't widely adopted)
Requirements
Description of the Change
The
utils.escape
function is amended to strip the escape sequence using a regular expression.Alternate Designs
he
library: dismissed because the direct fix is likely faster to become usablehe
: dismissed because the correct escaping in JavaScript is harder to findWhy should this be in core?
The
xunit
reporter is in core and should not be buggyBenefits
xunit
reporter output can be consumed by tools that expect valid XMLPossible Drawbacks
Tools that process the XML as plain (unicode) text (unlikely) can no longer see the ANSI escape sequence.
Applicable issues
fixes #4526
This is a bug fix (patch release)