JUnit reporter XML output missing required classname attribute on testcase element
See original GitHub issueWhen producing JUnit XML output, the resulting XML file seems to be missing required attributes.
I found the following XML Schema Definition that indicates the required fields.
While I don’t think it is necessary to support every optional attribute, I think it would make sense to provide those that are mandatory.
I stumbled across this, as I tried to integrate ESlint output in GitLab CI, but GitLab CI will not display the report, as it requires the classname attribute to be present.
There is also an issue filed over at GitLab, but maybe it was more obvious to fix the issue in ESlint.
If you think here’s the right place to fix this, I’d be happy to contribute a Pull Request.
Tell us about your environment
- ESLint Version: v5.8.0
- Node Version: v10.12.0
- npm Version: 6.4.1
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration: ø
Configuration
# cat eslintconfig.json
{
"plugins": [],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"extends": ["eslint:recommended"]
}
# cat test.js
console.log('foo');
What did you expect to happen?
Expected the attribute classname
to be present on element <testcase />
— I suggest that classname will be set to basename
of the parents <testsuite/>
file
attribute.
<testsuites>
<testsuite package="org.eslint" time="0" tests="1" errors="1" name="/path/to/test.js">
<testcase time="0" classname="test" name="org.eslint.no-console">…</testcase>
</testsuite>
</testsuites>
What actually happened? Please include the actual, raw output from ESLint.
<!-- ⇒ ./node_modules/.bin/eslint -c eslintconfig.json -f junit test.js -->
<testsuites>
<testsuite package="org.eslint" time="0" tests="1" errors="1" name="/path/to/test.js">
<testcase time="0" name="org.eslint.no-console">… </testcase>
</testsuite>
</testsuites>
Are you willing to submit a pull request to fix this bug?
👍
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:15 (4 by maintainers)
Top GitHub Comments
@platinumazure Sorry, I did not want to rush things. The empty string turned out to be not too useful in terms of GitLab’s CI Panel (though valid w.r.t. to the schema).
I am locally playing around with using the filepath, but trimmed relative to the project root and without the filename suffix to have a things a little more readable for humans.
Currently it I imagine something like this:
Still this decision is kind of arbitrary as obviously the reporting format was invented for Java.
Feedback is very welcome. 😃
@micheee, 90% of something, is better than 0% of nothing, hombré. I’ll take what I can get!