Search code examples
angularsonarqubekarma-coveragelcov

Sonar Coverage: file path in lcov coverage report isn't correct


Sonar build is failed in bamboo because of LCOV.info file path is wrong. I have added script also in the Bamboo pipeline to find exact path for lcov.info and I am not getting any exact path in the log I am looking for.

what do I need to add in the sonar-properties file or karma.conf file?

Can someone help me?


Solution

    1. You need to make sure a coverage report is generated for the test. So if you are running something like npm test from your script in bamboo, make sure you have --code-coverage added in your package.json.

    2. In the sonar-project.properties file you need to set the path for where the file gets created.

    sonar.typescript.lcov.reportPaths=enter/your/path/here/lcov.info
    

    You can run the test local with coverage to see where the lcov.info file gets generated.