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 formatter should output passing <test> entries for rules that pass #9843

Closed
brettdh opened this issue Jan 12, 2018 · 6 comments
Closed
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion formatter Relates to the formatters bundled with ESLint

Comments

@brettdh
Copy link

brettdh commented Jan 12, 2018

Related: #9093, #9094

#9094 introduced junit output for the all-rules-passing case, which fixed a problem with Jenkins. However, CircleCI displays no test summary for eslint if the Junit XML contains only empty <testsuite>s and no <test>s.

Tell us about your environment

  • ESLint Version: 4.9.0
  • Node Version: 6.11.2
  • npm Version: 5.5.1
./node_modules/.bin/eslint index.js ./src/* ./__tests__/* --format junit

What did you expect to happen?
A non-zero number of (passing) <test>s in the XML output - one per rule per file (<testsuite>).

What actually happened? Please include the actual, raw output from ESLint.
Many <testsuite>s, all of which contained zero <test>s.

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Jan 12, 2018
@platinumazure
Copy link
Member

Does the formatter need to expose a test element per rule per file? Or just one passing test per suite/file?

Having a test element for every file sounds verbose to me, but I don't know JUnit.

@j-f1
Copy link
Contributor

j-f1 commented Jan 12, 2018

What about putting just one “linting passed” test in the suite if the file has no errors or warnings?

@brettdh
Copy link
Author

brettdh commented Jan 12, 2018

Note: I mistakenly wrote <test>; the correct element is <testcase>.

It seems cleaner (and yes, verbose) to me to have a <testcase> per rule per file, so that the test result XML contains a <testcase> for each test that was actually run.

Glancing at the code in #9094, it looks like there's a <testcase> per message per file, which I understand to be failed test cases. It seems more consistent to have individual success elements to match the individual failure elements. This also lets you look back and see the first build that introduced a rule.

A single passing <testcase> per suite on success would be better than none, though. I'm not sure how tools like CircleCI would behave if <testcase>s disappear after being fixed rather than just being set to "passed" as is the case for unit test reporters like jest-junit.

@platinumazure
Copy link
Member

@brettdh Would it be possible to link to a section of the JUnit specification (if there is one) to describe the correct behavior here? I'm honestly wondering if we should have only one testcase per rule per file even on failure (and put multiple error messages in a description, or assertion/failure, or something), and then have one testcase with no failures to indicate success...

@brettdh
Copy link
Author

brettdh commented Jan 12, 2018

That would make test results a lot less useful. Tools like Jenkins and CircleCI use the individual test cases to track failures over time by testcase name, and they assume a <testcase> is one test case - since it's the smallest unit of testing that the xml report allows.

A quick google search turns up lots of possible specs (including some XSD files). Not sure if any are authoritative. Maybe one of these?

@platinumazure platinumazure added enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion formatter Relates to the formatters bundled with ESLint and removed triage An ESLint team member will look at this issue soon labels Jan 14, 2018
@not-an-aardvark
Copy link
Member

Thanks for your interest in improving ESLint. Unfortunately, it looks like this issue didn't get consensus from the team, so I'm closing it. We define consensus as having three 👍s from team members, as well as a team member willing to champion the proposal. This is a high bar by design -- we can't realistically accept and maintain every feature request in the long term, so we only accept feature requests which are useful enough that there is consensus among the team that they're worth adding.

Since ESLint is pluggable and can load custom formatters at runtime, the lack of consensus among the ESLint team doesn't need to be a blocker for you using this in your project, if you'd find it useful. It just means that you would need to implement the formatter yourself, rather than using a bundled formatter that is packaged with ESLint.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Sep 2, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Sep 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion formatter Relates to the formatters bundled with ESLint
Projects
None yet
Development

No branches or pull requests

4 participants