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

XML parsing failures do not fail the action and can hide failing tests #1189

Open
aconti-ns1 opened this issue Sep 17, 2024 · 3 comments
Open

Comments

@aconti-ns1
Copy link

The current behavior if XML fails to parse is to log the following message and continue on:
⚠️ Failed to parse file (${file}) with error ${error}

This is not visible in the annotations, only if you go looking for the error. This can result in silent failures if the invalid XML contains failures. I would like to request a new option to cause parse errors to be reported more visibly. I have two suggestions:

Solution A

fail_on_parse_error: Optional. Fail the build in case of an XML parsing error

This would be the simpler solution to merely exit immediately when reaching a parsing failure, but would make it harder to identify which XML was causing the issue.

Solution B

report_on_parse_error: Optional. Report a failed test in case of an XML parsing error

In this solution, instead of returning an empty test suite here, a fake test suite could be returned indicating that the XML was not parsed.

@mikepenz
Copy link
Owner

Thank you for the report @aconti-ns1

Yes you are correct, the current behavior annotates it as an error to the build, however it does not fail the whole build.
https://github.com/mikepenz/action-junit-report/blob/main/src/testParser.ts#L180

I think your first proposal is a good proposal, to fail the build in case of a parsing error. as it will be the most visible way of an apparent failure due to a wrong xml.

@aconti-ns1
Copy link
Author

Thanks Mike, if I can get some time to work on a PR I'll do so. Do you have a preference for the option name?

@mikepenz
Copy link
Owner

fail_on_parse_error sounds good :)

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

No branches or pull requests

2 participants