I’m not sure if this is a bug, but I don’t think it should be. Below are the details of the situation I faced.
We have an ORB (helium10/h10-phpcs-review) which has this code:
- when: condition: << parameters.phpunit-parallelism >> steps: - run: name: Run PhpUnit tests in parallel mode command: | if [ $(docker exec --workdir=/app << parameters.container-name >> composer show -N 2>/dev/null | grep -c paratest) != "0" ]; then docker exec --workdir=/app << parameters.container-name >> ./artisan test --parallel \ <<# parameters.code-coverage >> --coverage-clover tests/reports/phpunit.coverage.xml <</ parameters.code-coverage >>; else docker exec --workdir=/app << parameters.container-name >> /app/vendor/bin/phpunit \ <<# parameters.code-coverage >> --coverage-clover tests/reports/phpunit.coverage.xml <</ parameters.code-coverage >>; fi - when: condition: << parameters.code-coverage >> steps: - run: name: Extract test report from a docker container command: | mkdir -p tests/reports docker cp << parameters.container-name >>:/app/tests/reports tests sed -i 's@/app/tests/@tests/@g' tests/reports/phpunit.junit.xml sed -i 's@/app/app/@app/@g' tests/reports/phpunit.coverage.xml - store_test_results: path: tests/reports - store_artifacts: path: tests/reports
When we use this orb in the project, the task works correctly, testing is performed, but at the step “- store_test_results:” I get the following error:
Archiving the following test results
failed uploading test results: File: home/circleci/project/tests/reports/phpunit.coverage.xml had the following problems:
- invalid top level element: coverage
At the same time, the task does not fall and the workflow continues to work.
I tried changing the coverage report formats using the PHPUnit settings, but the error does not go away, only the message about the wrong top-level element changes.
And here is my questions:
- Why does the “store_test_results” command give an error for the standard xml report generated by phpunit in “Clover XML” format?
- How to get rid of this error?
I would appreciate any ideas and answers on this topic. =)