In Angular project unable to generate test coverage in sonar with karma ( we are using Jenkins file)

Viewed 14

We are trying to generate code coverage in sonarqube for angular project . In our local we are able to generate the karma code coverage but in sonarqube we are not getting any code coverage getting this error : FCPH-254-test/reports/*.xml (No such file or directory)

In sonar-project.properties :

sonar.exclusions=test/services/*.test.js,test/*.test.js , **/*.js.flow
sonar.c.file.suffixes=**/*.c
sonar.cpp.file.suffixes=**/*.cpp
sonar.objc.file.suffixes=**/*.mm
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.testExecutionReportPaths=reports/chrome.105.0.0.0.windows.10.xml

In Jenkins file :

stage("Build") {
            env.SASS_BINARY_SITE = 'https://ci-repo.aexp.com/repository/github-node-sass/download'
            env.PHANTOMJS_CDNURL = 'https://ci-repo.aexp.com/nodejs/content/sites/npm-remotes/ariya/phantomjs/downloads/'
            env.NODEJS_ORG_MIRROR = 'https://ci-repo.aexp.com/repository/nodejs-proxy/'
            npmUtils.npm "ci"
            npmUtils.npm "test"
            npmUtils.npm "run build"
            npmUtils.npm "test --code-coverage --watch=false"
        }

        stage("Scan") {
                sonarscanonly {
                    language="js"
                }
        }
0 Answers
Related