"The main branch has no lines of code" issue even though code coverage well visible in npm test command

  • ALM used - Bitbucket Cloud
  • CI system - Bitbucket Cloud
  • Scanner command used when applicable
  • pipe: sonarsource/sonarcloud-scan:1.2.1 # sonar scan pipe
    variables:
    EXTRA_ARGS: ‘-Dsonar.sources= -Dsonar.tests= -Dsonar.test.inclusions="—" -Dsonar.javascript.lcov.reportPaths=coverage/lcov.info’
  • pipe: sonarsource/sonarcloud-quality-gate:0.1.4 # sonar quality gate pipe
  • Languages of the repository - .js and .ts

  • Error observed -
    I don’t see any errors during scan. But no code scan visible after the scan. Getting below outputs in the overview tab
    “The main branch has no lines of code.”

Looks to me like your values for “sonar.sources” and “sonar.tests” are blank. At a minimum, you have to have some value for “sonar.sources” so it knows where your code is.

Sorry for the confusion. I had left it blank intentionally.

  • pipe: sonarsource/sonarcloud-scan:1.2.1 # sonar scan pipe
    variables:
    EXTRA_ARGS: ‘-Dsonar.sources=src -Dsonar.tests=src -Dsonar.test.inclusions="/testing/,/*.spec.ts,/.test.ts,**/.ts,/src/" -Dsonar.javascript.lcov.reportPaths=coverage/lcov.info’

        - pipe: sonarsource/sonarcloud-quality-gate:0.1.4 # sonar quality gate pipe