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

Fix incompatible encodings error in Junit formatter #1244

Merged
merged 3 commits into from
Jan 21, 2018

Conversation

NickAb
Copy link
Contributor

@NickAb NickAb commented Jan 14, 2018

Summary

Fix incompatible character encodings error in Junit formatter which occurs if strings with incompatible encodings were written to pipe.

Details

Replaced array buffer in Interceptor::Pipe with StringIO to prevent incompatible character encodings error. This also elements need to join array in Junit formatter and reduces exposure of internals of pipe interceptor. Although #buffer method was kept and is backward compatible in case any end user code is using it.

Motivation and Context

This fixes issues of cucumber failing to generate junit report for test cases that had non UTF strings in different languages logged during test run.

How Has This Been Tested?

Add test case for junit formatter to write output in case of incompatible strings being logged during test run.

Screenshots (if appropriate):

Types of changes

  • Refactor (code change that does not change external functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • I've added tests for my code
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@NickAb NickAb changed the title Incompatible encodings Fix incompatible encodings error in Junit formatter Jan 14, 2018
@NickAb
Copy link
Contributor Author

NickAb commented Jan 14, 2018

I am not sure how to make both is able to strip control chars from cdata and is able to handle multiple encodings in pipe to work at the same time. At the moment newly added test redefines Junit class which breaks existing test for control characters.

@NickAb NickAb force-pushed the incompatible-encodings branch from 22589c8 to f14503b Compare January 14, 2018 20:24
@brasmusson
Copy link
Contributor

@NickAb Rebase on the latest commit on master and change is able to handle multiple encodings in pip the same way as is able to strip control chars from cdata is changed in that commit. Then both should work.

@NickAb NickAb force-pushed the incompatible-encodings branch from f14503b to 1a7612b Compare January 15, 2018 21:43
@NickAb
Copy link
Contributor Author

NickAb commented Jan 15, 2018

@brasmusson thank you. All done

@brasmusson
Copy link
Contributor

Lets add a deprecation warning for #buffer.

@brasmusson brasmusson merged commit 0cc6a78 into cucumber:master Jan 21, 2018
@aslakhellesoy
Copy link
Contributor

Hi @NickAb,

Thanks for your making your first contribution to Cucumber, and welcome to the Cucumber committers team! You can now push directly to this repo and all other repos under the cucumber organization! 🍾

In return for this generous offer we hope you will:

  • ✅ Continue to use branches and pull requests. When someone on the core team approves a pull request (yours or someone else's), you're welcome to merge it yourself.
  • 💚 Commit to setting a good example by following and upholding our code of conduct in your interactions with other collaborators and users.
  • 💬 Join the community Slack channel to meet the rest of the team and make yourself at home.
  • ℹ️ Don't feel obliged to help, just do what you can if you have the time and the energy.
  • 🙋 Ask if you need anything. We're looking for feedback about how to make the project more welcoming, so please tell us!

On behalf of the Cucumber core team,
Aslak Hellesøy
Creator of Cucumber

brasmusson added a commit that referenced this pull request Jan 21, 2018
@mxygem mxygem mentioned this pull request Jan 22, 2018
@brasmusson
Copy link
Contributor

The fix does not work on JRuby, see https://circleci.com/gh/cucumber/cucumber-ruby/849, and also #1259.

@lock
Copy link

lock bot commented Jan 22, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants