Javascript coverage path doesn't support wildcard anymore

  • ALM used : Azure DevOps
  • CI system used : Azure DevOps
  • Scanner Azure DevOps task version : 3.1.1
  • Languages of the repository : Mono repo with C# and Angular / Typescript, only scanning for Typescript.

Since migrating from SonarCloudPrepare@2 to SonarCloudPrepare@3 we noticed that the analysis is not able to find the lcov files.
We are using NX so there are multiple lcov files, we need the wildcards to gather them all.

We did not change the configuration between v2 and v3 of the task

Command with relevant parameters :

  - task: SonarCloudPrepare@3
    displayName: "Prepare UI analysis on SonarCloud"
    inputs:
      workingDir: "Front"
      SonarCloud: "*****"
      organization: "****"
      scannerMode: cli
      configMode: manual
      cliProjectKey: ****
      cliProjectName: ****
      cliProjectVersion: ****
      extraProperties: |
        sonar.projectBaseDir=$(Build.SourcesDirectory)/Front
        sonar.javascript.lcov.reportPaths="**/Front/coverage/**/lcov.info"

Before v3 the command was exactly the same

The result was:

...
Sensor JavaScript/TypeScript Coverage [javascript]
Analysing [C:\a\10\s\Front\coverage\apps\******\lcov.info, C:\a\10\s\Front\coverage\libs\*******\lcov.info, ...]
...

Now, with v3, the output is:

Sensor JavaScript/TypeScript Coverage [javascript]
No LCOV files were found using C:\a\4\s/Front/coverage/**/lcov.info
No coverage information will be saved because all LCOV files cannot be found.
Sensor JavaScript/TypeScript Coverage [javascript] (done) | time=1757ms

I checked, the files lcov are there.

If I change the reportPaths to target a specific file.:
sonar.javascript.lcov.reportPaths="$(Build.SourcesDirectory)/Front/coverage/apps/my-apps-folder/lcov.info"

It finds it properly :

Sensor JavaScript/TypeScript Coverage [javascript]
Analysing [C:\a\10\s\Front\coverage\apps\my-app-folder\lcov.info]
Could not resolve 6 file paths in [C:\a\10\s\Front\coverage\apps\my-apps-folder\lcov.info]
First unresolved path: apps\my-apps-folder\src\app\analysis\services\********.ts (Run in DEBUG mode to get full list of unresolved paths)
Sensor JavaScript/TypeScript Coverage [javascript] (done) | time=61ms

My conclusion is that there seems to be a breaking change with the wildcard handling, it doesn’t seem to understand it anymore.

Any suggestion ?

Hey there.

Just to make sure the issue isn’t somewhere else, if you switch back to SonarCloudPrepare@2 today, does the behavior go back as it was?

Hello,
Thanks for your reply.
After a lot of testing, it seems that the issue is caused by sonar.projectBaseDir.
Removing it fixed the issue, I’m not really sure why it was there as it seems to work well without.

But still there is something strange as the paths are correct, and the path in the error message is also correct.
So, I’m probably wrong and there is no issue with the wildcards but there is still something strange, either in the error message (which may report a different path than the one it is really using), or maybe it doesn’t like wildcard when the projectBaseDir is specified, or if the path is absolute.

I’ll try to do more testing to find out, but I’m not sure I’ll have the time.

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