Hi
I can’t seem to get my coverage from npm jest-sonar-reporter
. So i’ll show my setup.
package.json
"jestSonar": {
"reportPath": "src",
"reportFile": "test-reporter.xml",
"indent": 4
},
That successfully generate the file in my vue src folder. I’m running sonarQube in docker and the using the runner like so:
docker run -ti -v /Users/jonny/ios/myapp.js:/usr/src --link sonarqube newtmitch/sonar-scanner -Dsonar.host.url=http://sonarqube:9000 -Dsonar.jdbc.url=jdbc:h2:tcp://sonarqube/sonar -Dsonar.projectKey=vue -Dsonar.projectName="vue" -Dsonar.projectVersion=1 -Dsonar.sources=src -Dsonar.login=722sdc70c79343f17d34d7be33b4d190b446b795 -Dsonar.testExecutionReportPaths="src/test-reporter.xml" -Dsonar.tests=tests -Dsonar.test.inclusions=tests/unit/*.spec.js
My folder structure is like so
app
- src
- tests
- unit
file.spec.js
file2.spec.js
The output from the console I see though is this:
INFO: Sensor JavaXmlSensor [java]
INFO: 1 source files to be analyzed
INFO: Sensor JavaXmlSensor [java] (done) | time=491ms
INFO: Sensor HTML [web]
INFO: 1/1 source files have been analyzed
INFO: Sensor HTML [web] (done) | time=67ms
INFO: Sensor XML Sensor [xml]
INFO: 1 source files to be analyzed
INFO: Sensor XML Sensor [xml] (done) | time=1209ms
INFO: 1/1 source files have been analyzed
INFO: Sensor Generic Test Executions Report
INFO: Parsing /usr/src/src/test-reporter.xml
INFO: Imported test execution data for 0 files
INFO: Test execution data ignored for 2 unknown files, including:
/Users/jonny/ios/myapp.js/tests/unit/helper.spec.js
/Users/jonny/ios/myapp.js/tests/unit/ListFilter.spec.js
INFO: Sensor Generic Test Executions Report (done) | time=99ms
INFO: ------------- Run sensors on project
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=286ms
INFO: SCM Publisher is disabled
These files generally look like this:
<?xml version="1.0" encoding="UTF-8"?>
<testExecutions version="1">
<file path="/Users/jonny/ios/myapp.js/tests/unit/helper.spec.js">
<testCase name="Check header builds properly" duration="16"/>
<testCase name="Check basic auth header works" duration="3"/>
</file>
<file path="/Users/jonny/ios/myapp.js/tests/unit/ListFilter.spec.js">
<testCase name="TheListFilter.vue renders ok" duration="52"/>
</file>
</testExecutions>
So just wondering what I need to do to get the coverage into the sonarQube analysis?