Coder Social home page Coder Social logo

Comments (17)

brenuart avatar brenuart commented on May 20, 2024 9

Any chance this issue gets some attention from maintainers? At least some indication about whether this feature request makes sense or not.. ?
Ping @andrey-tyukin-sonarsource, @vilchik-elena ...

from sonarjs.

hoch4 avatar hoch4 commented on May 20, 2024 7

This workaround works well too

#!/bin/sh
coverage=$(find -type f -name '*coverage.lcov' -printf "%p,")
testResults=$(find -type f -name '*test-result.xml' -printf "%p,")

mvn sonar:sonar \
  -Dsonar.projectKey=my.project.key.from.sonarqube \
  -Dsonar.host.url=http://mysonarqubeserver.com:9000 \
  -Dsonar.login=kd94kaek94ad9duiope67fbn89vbnnn89dw \
  -Dsonar.sources="." \
  -Dsonar.tests="." \
  -Dsonar.test.inclusions="**/*.spec.ts" \
  -Dsonar.javascript.lcov.reportPaths="${coverage}" \
  -Dsonar.testExecutionReportPaths="${testResults}"

from sonarjs.

pburkindine avatar pburkindine commented on May 20, 2024 6

Also badly need this feature for js/ts

from sonarjs.

fadc80 avatar fadc80 commented on May 20, 2024 5

Is there any chance to see this issue resolved soon?

from sonarjs.

ivandalbosco avatar ivandalbosco commented on May 20, 2024 3

+1
As regards SQ < 6.2: I suggest we simply pick the cheapest solution between support and non support of wild cards.

from sonarjs.

clok avatar clok commented on May 20, 2024 3

Bump. This would be very helpful!

from sonarjs.

arobinson avatar arobinson commented on May 20, 2024 2

I'm still having this problem. I've tried both * and ** with no luck with sonar.javascript.lcov.reportPaths

Using

export SONAR_SCANNER_VERSION="5.0.1.3006"

And

"sonarqube-scanner": "^3.3.0

Error:

14:47:08  INFO: No LCOV files were found using /home/ec2-user/workspace/Client/some-workspace/test-results/coverage/*.lcov.info
14:47:08  WARN: No coverage information will be saved because all LCOV files cannot be found.

I archived the test-results/coverage folder as part of the Jenkins job, and verified the path is correct and should have matched 4 files. Also, from the error, it does not sound like it is using the code that was in the fix for this issue.

What version needs to be used to obtain the fix?

from sonarjs.

ideadapt avatar ideadapt commented on May 20, 2024 1

I use something like

{ type: 'lcov', dir: 'test/reports/unit/coverage/lcov/', subdir: function(browser) {
    // keep a consistent browser name across different OS & browser versions
    return browser.toLowerCase().split(/[ /-]/)[0];
  }
}

to generate a version neutral path. Found at https://github.com/karma-runner/karma-coverage/blob/master/docs/configuration.md

from sonarjs.

roy-bakker-new10 avatar roy-bakker-new10 commented on May 20, 2024 1

Would still love this!

from sonarjs.

Rai-Rai avatar Rai-Rai commented on May 20, 2024 1

๐Ÿ‘
Need support for wildcards for sonar.typescript.lcov.reportPaths really desperate....

from sonarjs.

mariamatthews avatar mariamatthews commented on May 20, 2024 1

Note: I am aware that this is now closed and merged in the new version, but for those who cannot upgrade

Hi guys, could I suggest using a quick bash script before your SonarQube runs that would identify the file/folder locations for you as a workaround?

Putting the below path and updating the packages folder name to the root folder of your projects should find the exact locations for you.

Code:

  - bash: |
      for entry in packages/*/
      do
      if [ "$entry" == "packages/common/" ] ; then
            continue;
      fi
      testPaths=${testPaths}${entry}test-report.xml,
      coveragePaths=${coveragePaths}${entry}coverage/lcov.info,
      done
      testPaths=${testPaths%,}
      coveragePaths=${coveragePaths%,}
      echo "Test and coverage reports paths found: "
      echo "Test reports: $testPaths"
      echo "Coverage reports: $coveragePaths"
      echo "Setting pipeline variables..."
      echo "##vso[task.setvariable variable=TESTPATHS]$testPaths"
      echo "##vso[task.setvariable variable=COVERAGEPATHS]$coveragePaths"
    displayName: Getting report paths for SonarQube

The above task would iterate over the folders and add the files found within the temporary Azure Pipelines variables.
The if statement is where you could add any folders you would like it to skip.

This means that you can set SonarQube reportPaths like:

      sonar.testExecutionReportPaths=$(TESTPATHS)
      sonar.javascript.lcov.reportPaths=$(COVERAGEPATHS)

Let me know if you have found it useful and if it worked for you (in the case where you can't upgrade your SonarQube instance) ๐Ÿงก

from sonarjs.

vilchik-elena avatar vilchik-elena commented on May 20, 2024

There is implementation for wildcard support in sonarGo and SonarPython. We should migrate it to sonar-analyzer-commons

from sonarjs.

hzdavid avatar hzdavid commented on May 20, 2024

so Could we use wildcards to . sonar.jacoco.reportPaths now ?

from sonarjs.

dblees avatar dblees commented on May 20, 2024

sonar.jacoco.reportPaths and sonar.jacoco.classes .. this does not seem to support wildcards .. is this correct? If so, until this is supported this feels brittle. every time a codebase changes, this forces maintenance of configuration to capture reports and classes. please consider this feature. thanks.

from sonarjs.

vilchik-elena avatar vilchik-elena commented on May 20, 2024

@Rai-Rai since last release (SonarTS 2.0 and SonarJS 6.0) there is single logic and property to load coverage for TS and JS: sonar.javascript.lcov.reportPaths

from sonarjs.

brenuart avatar brenuart commented on May 20, 2024

Would love this too - and not only for SonarJS but not only for coverage report paths but others as well, like:

  • sonar.javascript.lcov.reportPaths
  • sonar.typescript.tslint.reportPaths
  • sonar.testExecutionReportPaths (generic report)

As @vilchik-elena said, they all share a common logic located in sonar-analyzer-commons (https://github.com/SonarSource/sonar-analyzer-commons/blob/master/commons/src/main/java/org/sonarsource/analyzer/commons/ExternalReportProvider.java#L35) - can't we simply adapt it to support ANT-style patterns for instance?

Would you consider a PR for this ?

from sonarjs.

lpcruz avatar lpcruz commented on May 20, 2024

Bumping this as well--- currently in a situation where we need to support multiple lcov reports so having it be a capability of Sonar itself would be amazing.

from sonarjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.