vuejs / vue-cli

🛠️ webpack-based tooling for Vue.js Development
https://cli.vuejs.org/
MIT License
29.76k stars 6.33k forks source link

vue-cli-service lint --format junit is unhelpful #6063

Open cawoodm opened 3 years ago

cawoodm commented 3 years ago

Version

4.4.6

Environment info

'vue' is not recognized as an internal or external command, operable program or batch file.

Steps to reproduce

npx vue-cli-service lint --max-warnings 0 --no-fix --silent --format junit > junit.xml

What is expected?

I would expect the junit output to be consistent and helpful to finding which .vue component has linting issues.

Secondary gripe: I would also expect a -o option to output to a file. Output redirection is a pain here because if the tests fail then invalud XML (plain text) is generated.

What is actually happening?

The vue-cli-service lint command creates unhelpful output in junit format. In particular the fact that the name attribzte of a failed testcase is not set to the path is very confusing especially to Azure Devops Pipelines which parse the test results. They show the name attribute and for failed tests this is the eslint rule name. So you see "org.eslint.no-trailing-spaces" but have no idea where that rule was broken.

For passed tests the name attribute is the path to the component - this should always be the case.

<testsuites>
  <testsuite package="org.eslint" time="0" tests="1" errors="0" name="/home/vsts/work/1/s/hybris/bin/custom/applicationstyleguide/src/src/common/components/add-to-template-dropdown/AddToTemplateDropdown.vue">
    <testcase time="0" name="/home/vsts/work/1/s/hybris/bin/custom/applicationstyleguide/src/src/common/components/add-to-template-dropdown/AddToTemplateDropdown.vue" classname="/home/vsts/work/1/s/hybris/bin/custom/applicationstyleguide/src/src/common/components/add-to-template-dropdown/AddToTemplateDropdown" />
  </testsuite>
  <testsuite package="org.eslint" time="0" tests="1" errors="1" name="/home/vsts/work/1/s/hybris/bin/custom/applicationstyleguide/src/src/common/components/buy-box/BuyBox.vue">
    <testcase time="0" name="org.eslint.no-trailing-spaces" classname="/home/vsts/work/1/s/hybris/bin/custom/applicationstyleguide/src/src/common/components/buy-box/BuyBox"><failure message="Trailing spaces not allowed."><![CDATA[line 147, col 23, Error - Trailing spaces not allowed. (no-trailing-spaces)]]></failure></testcase>
  </testsuite>
</testsuites>
cawoodm commented 3 years ago

More details and screenshots here: https://github.com/microsoft/azure-pipelines-tasks/issues/13905