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

Add file attr #71

Merged
merged 1 commit into from
Jan 10, 2019
Merged

Add file attr #71

merged 1 commit into from
Jan 10, 2019

Conversation

mtsmfm
Copy link
Contributor

@mtsmfm mtsmfm commented Dec 23, 2018

Ref: #70
This PR depends on #70

@palmerj3

Before I merge could you please just provide a rationale for this change? What problem(s) is it solving on your end?

I'd like to add file attr because some tools (ex. circleci) show file path if the report has this attr.
I thought to fix the path and to add attr can be split but actually, this PR is what I need.

sj26/rspec_junit_formatter#22

@palmerj3
Copy link
Collaborator

Hey thanks for clarifying.

I'm concerned about merging this because, as far as I can tell, it would not be a valid junit xml file after this change.

You can see from here https://github.com/jest-community/jest-junit/blob/master/__tests__/lib/junit.xsd that testcase elements don't have a "file" attribute or sub-element. We do have an automated test which tests the generated xml against the xsd included in the project so clearly it passed.

But my concern is that it may mess with other CI environments/systems that are possibly more strict?

Let me do a bit of research on this and see if this could cause any potential problems. I would love to extend the junit and add all sorts of things but it's crucial that we maintain compatibility.

@palmerj3
Copy link
Collaborator

In my experience the "classname" is the attribute on "testcase" which can represent the path to the file. In a java system it tends to, anyway. This is already configurable in jest-junit and your previous PR would make that a relative file path. Would circle-ci handle "classname" like you are wanting?

@mtsmfm
Copy link
Contributor Author

mtsmfm commented Dec 24, 2018

Would circle-ci handle "classname" like you are wanting?

It seems no.

Without file attr

https://circleci.com/gh/mtsmfm/jest-junit/7

screen shot 2018-12-24 at 20 35 55

With file attr

https://circleci.com/gh/mtsmfm/jest-junit/8

screen shot 2018-12-24 at 20 36 25

@palmerj3
Copy link
Collaborator

Ok thanks for the detailed explanation and for being patient on this. I merged the other PR.

Will spend a few days researching if this change would cause any known issues. Regardless, this change + the other PR will likely result in a new major version to be on the safe side since this would potentially be a breaking change.

@mtsmfm
Copy link
Contributor Author

mtsmfm commented Jan 4, 2019

@palmerj3 Have you found this change breaks something?

@palmerj3
Copy link
Collaborator

palmerj3 commented Jan 4, 2019

Hey @mtsmfm I'm doing my best to talk with a few CI vendors about this to see if there is any likelihood if it breaking.

Again, my main concern here is that this is technically not valid junit xml. If it is only circle ci that makes use of this non standard attribute then I would prefer for them to update their systems to support className.

But if you don't mind giving me another week I'll do my best to see if this is likely to actually break anything and possibly talk to the folks at circle.

@palmerj3
Copy link
Collaborator

@mtsmfm so after speaking to some folks from circle and a few other folks familiar with this space I think it's safe for me to merge this. I will be even more safe and do a major version bump even though it's probably not necessary. Thanks again for making this change!

@palmerj3 palmerj3 merged commit 0fb5aec into jest-community:master Jan 10, 2019
@palmerj3
Copy link
Collaborator

@mtsmfm 6.0.0 has been published with these changes. Thank you!

https://github.com/jest-community/jest-junit/releases/tag/v6.0.0

@mtsmfm
Copy link
Contributor Author

mtsmfm commented Jan 11, 2019

@palmerj3 Thanks!
I've updated jest-junit to v6 in my project and confirmed circleci recognizes file name now!


speaking to some folks from circle and a few other folks familiar with this space I think it's safe for me to merge this

Just curious though, could you tell me why did you change your mind?

my main concern here is that this is technically not valid junit xml

I researched and I couldn't find any other tools which accepts file attr except circleci.
I think current junit xml specification lacks this important information but yeah, it's invalid as junit xml format.

@mtsmfm mtsmfm deleted the file-attr branch January 11, 2019 06:57
@palmerj3
Copy link
Collaborator

@mtsmfm all the folks I talked to reassured me that there was no, one, standard for junit files. So, although they do all follow a similar structure, something like this should cause no harm to systems that don't recognize the "file" attribute.

@palmerj3
Copy link
Collaborator

@mtsmfm so it appears that this change causes a problem with jenkins xunit processor. I feel it's the right move to rollback right now and publish a patch release.

I'll continue looking into this. But, for now, you might consider resubmitting this PR and add a configuration option where this attribute is conditionally added.

@palmerj3 palmerj3 mentioned this pull request Jan 11, 2019
@mtsmfm
Copy link
Contributor Author

mtsmfm commented Jan 12, 2019

you might consider resubmitting this PR and add a configuration option where this attribute is conditionally added.

Okay, sorry for introducing the problem 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants