-
Notifications
You must be signed in to change notification settings - Fork 110
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
Add XML prolog to junit output #72
Conversation
* new string constant and options added for prolog * README updated with new options
Hey @lalugeo thanks for submitting this! Can you just briefly describe what this PR achieves? Are you having an issue with the generated XML? |
Thank you for the quick response. But sorry, i was just editing the PR to include my comments 😊 |
@lalugeo ok that seems reasonable. Given this do you see any risk in this simply being hardcoded and not a CLI option? So we would always have a prolog. |
The risk might be to any text based or regex based parsing being done by the consumers of this package on the output xml file. In such scenarios, this PR would break their implementations. Hence I added a flag that has default value of false, causing the prolog to be not added to the output. So if any consumer of this package, needs the prolog, they have to specifically turn on this flag. But of course, to keep it simple, we could always harcode it without any of the options, which would cause the prolog to be returned always. |
I'm not too worried about people who parse these with regex when we generate valid xml. If you wouldn't mind, I think I would rather see this prolog hard coded so we reduce the configuration options. |
Sure, i have made those changes. |
@lalugeo thank you! I'm sorry I don't mean to nitpick. We're very close to just merging this. I feel it would be a lot cleaner if we used the xml lib to add this prolog instead of string concat. See "Declaration example" here https://github.com/dylang/node-xml Mind making that change? |
Yes, you are right, this is a way more cleaner option. Thanks for pointing me out in that direction. Also, do you think the xml sample outputs in the README should be updated with the new prolog lines too? |
@palmerj3 , any updates on the merge? |
@lalugeo hey I'm sorry I've been quite busy this week. I will get to this tomorrow. |
@lalugeo this has been merged and I published jest-junit 6.1.0 which includes this. Please let me know if there are any issues. |
Issue:
Many XML parsers require the XML Prolog at the beginning of the xml file to start parsing.
Change proposed
Add an optional feature to control whether the generated XML should contain a XML prolog or not.This is controlled with the newly created flag calledincludeXmlProlog
as the package.json key orJEST_JUNIT_INCLUDE_XML_PROLOG
as the environment variable.Include the declaration of the XML prolog persistently in the output always
Before
After