Sonar.tests property not being picked up by sonarqube-scanner

I have sonar.sources set to /var/lib/jenkins/jobs/IH-First/workspace/src and sonar.tests is also set to the same directory.
test.ts is also in the same directory.

However when I do a npm run sonar-scanner it gives me

ERROR: Invalid value of sonar.tests for IH-First
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 2.157s
INFO: Final Memory: 6M/24M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
ERROR: The folder '/var/lib/jenkins/jobs/IH-First/workspace/src#Where to pickup test files from' does not exist for 'IH-First' (base directory = /var/lib/jenkins/jobs/IH-First/workspace)

My sonar-project.properties is as below:

sonar.host.url=http://localhost:9000
sonar.projectKey=First-Angular
sonar.projectBaseDir=/var/lib/jenkins/jobs/IH-First/workspace
sonar.projectName=Let us See # name that will be displayed on the dashboard
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8
sonar.sources=/var/lib/jenkins/jobs/IH-First/workspace/src
sonar.exclusions=**/node_modules/**
sonar.tests=/var/lib/jenkins/jobs/IH-First/workspace/src#Where to pickup test files from
sonar.test.inclusions=**/*.spec.ts # only collect these for test-coverage
sonar.javascript.lcov.reportPaths=src/coverage/PROJECT_NAME/lcov.info
sonar.testExecutionReportPaths=reports/sonarqube_report.xml
sonar.javascript.node.maxspace=4096
sonar.projectKey=IH-First

My code is structured as follows:

/var/lib/jenkins/jobs/IH-First/workspace$ ls -al
total 816
drwxr-xr-x   6 jenkins jenkins   4096 Sep 30 20:13 .
drwxr-xr-x   5 jenkins jenkins   4096 Sep 30 19:49 ..
-rw-r--r--   1 jenkins jenkins    246 Sep 30 19:49 .editorconfig
drwxr-xr-x   8 jenkins jenkins   4096 Sep 30 19:49 .git
-rw-r--r--   1 jenkins jenkins    615 Sep 30 19:49 .gitignore
-rw-r--r--   1 jenkins jenkins  17098 Sep 30 19:49 License.md
-rw-r--r--   1 jenkins jenkins    842 Sep 30 19:49 README.md
-rw-r--r--   1 jenkins jenkins   4387 Sep 30 19:49 angular.json
drwxr-xr-x   3 jenkins jenkins   4096 Sep 30 19:49 e2e
-rw-r--r--   1 jenkins jenkins    511 Sep 30 19:49 ngsw-config.json
drwxr-xr-x 970 jenkins jenkins  32768 Sep 30 19:50 node_modules
-rw-r--r--   1 jenkins jenkins 713142 Sep 30 19:50 package-lock.json
-rw-r--r--   1 jenkins jenkins   2460 Sep 30 19:50 package.json
-rw-r--r--   1 jenkins jenkins    734 Sep 30 20:13 sonar-project.properties
drwxr-xr-x   5 jenkins jenkins   4096 Sep 30 19:49 src
-rw-r--r--   1 jenkins jenkins    435 Sep 30 19:49 tsconfig.json
-rw-r--r--   1 jenkins jenkins   2824 Sep 30 19:49 tslint.json

src listing is:

/var/lib/jenkins/jobs/IH-First/workspace$ ls src
app     browserslist  favicon.ico  karma.conf.js  manifest.json  styles.css  tsconfig.app.json   tslint.json
assets  environments  index.html   main.ts        polyfills.ts   test.ts     tsconfig.spec.json

Can anyone point me to what am I missing?

Thanks

Hi,

Maybe it’ll be more obvious with line wrapping:

Your end-of-line comment isn’t being recognized as such. You should move that comment to the line before.

 
HTH,
Ann

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.