sj26 / rspec_junit_formatter

RSpec results that your CI can read
http://rubygems.org/gems/rspec_junit_formatter
MIT License
302 stars 122 forks source link

Replace invalid characters with a placeholder #105

Open JohnFinn000 opened 8 months ago

JohnFinn000 commented 8 months ago

It seems that when tests print an emoji in the failure reason rspec_junit_formatter fails and prints the xml its already generated to that point which ends up being invalid because it creates an xml element with a missing closing brackets and that cannot be parsed by the tools that attempt to read it.

This fix causes invalid characters to be replaced with ??invalid?? instead of bailing out immediately. rspec_junit_formatter shouldn't output invalid xml regardless of the failures it encounters along the way.

This should fix this issue: https://github.com/sj26/rspec_junit_formatter/issues/92

hdost commented 4 months ago

This would be useful 👍🏼

Unknown-Guy commented 4 months ago

Tested this on our CI, fixed similar error with invalid XML.