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

JUnit report treats all severities as failures #457

Open
InvisibleSmiley opened this issue Feb 16, 2024 · 2 comments
Open

JUnit report treats all severities as failures #457

InvisibleSmiley opened this issue Feb 16, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@InvisibleSmiley
Copy link

InvisibleSmiley commented Feb 16, 2024

First of all, thanks for this great tool and the JUnit report format output option. Much appreciated!

We use the JUnit report format to create reports for Jenkins so that a build fails if an OpenAPI file fails to pass linting.

Not all issues that are found are of the same importance to us, so we use a custom ruleset to disable or change/downgrade the serverity of certain rules.

However it turns out that the JUnit report creates failure tags in the output XML for all severities.
For "error" that is clear, for "warn" it is debatable, but for "info" and "hint" it is outright wrong. Those should not be treated as failures.
The failure tags include the severity as "type" attrribute but that makes no difference to applications that interpret the result XML. All they see is a failure. AFAIK, applications commonly only discriminate between errors, failed and skipped tests.

As a workaround we needed to disable all rules that we actually only wanted to downgrade in severity.

Ideally I'd like to have only "error" result in a JUnit report failure, "warn" maybe depending on an extra flag, and "info" and "hint" getting ignored for this report format. The latter two severities would then only appear in "lint" output.

Regarding the "treat warnings as errors" flag, maybe let yourself inspire by this Spectral issue: stoplightio/spectral#935

@InvisibleSmiley
Copy link
Author

In the end what I need is a way to "sync" the exit code of the "lint" command with the presence/absencse of "failure" tags in the JUnit report XML. If the former returns 0, the latter should be absent and vice-versa.

@daveshanley daveshanley added the enhancement New feature or request label Feb 19, 2024
@evilz
Copy link

evilz commented Mar 22, 2024

As said before this tool as great and junit IS very cool for CI.
Do you think it's possible to add pass test when check is OK. Cause it looks so red 😅

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

No branches or pull requests

3 participants