Angular Unit Test Cases Not showing

Preformatted textHi,

Unit Tests are not showing in Sonar dashboard. When I am tried with local sonarqube its working fine and I am able to see Test cases. But When I am trying with SonarCloud Unit Tests are not getting published and test files are getting ignored. I tried many ways but unable to resolve. Please help me on this Issue.

Note: We have multiple projects in same repository.

Integrated with Azure DevOps.

Below is karma.conf.js file:

// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
  config.set({
    basePath: "",
    frameworks: ["jasmine", "@angular-devkit/build-angular"],
    plugins: [
      require("karma-jasmine"),
      require("karma-chrome-launcher"),
      require("karma-jasmine-html-reporter"),
      require("karma-coverage"),
      require("karma-coverage-istanbul-reporter"),
      require("@angular-devkit/build-angular/plugins/karma"),
      require('karma-sonarqube-unit-reporter'),
    ],
    sonarQubeUnitReporter: {
      sonarQubeVersion: 'LATEST',
      outputDir: "testresults/unittest",
      outputFile: 'unit-test-result.xml',
      overrideTestDescription: true,
      testPaths: ['./src'],
      testFilePattern: '.spec.ts',
      useBrowserName: false
    },
    client: {
      jasmine: {
        // you can add configuration options for Jasmine here
        // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
        // for example, you can disable the random execution with `random: false`
        // or set a specific seed with `seed: 4321`
      },
      clearContext: false, // leave Jasmine Spec Runner output visible in browser
    },
    coverageIstanbulReporter: {
      dir: require("path").join(__dirname, "./coverage/FordPro"),
      reports: ["html", "lcovonly", "text-summary"],
      fixWebpackSourcePaths: true,
    },
    jasmineHtmlReporter: {
      suppressAll: true, // removes the duplicated traces
    },
    coverageReporter: {
      type: "cobertura",
      dir: "testresults",
      subdir: "coverage",
      file: "code-coverage.xml",
    },
    reporters: ["progress", "kjhtml", "coverage", "sonarqubeUnit"],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    //browsers: ['Chrome'],
    browsers: ["ChromeHeadless"],
    singleRun: false,
    restartOnFileChange: true,
  });
};

Below are the Azure Devops logs.

2021-09-06T14:10:32.4510518Z ##[section]Starting: Complete the SonarQube analysis
2021-09-06T14:10:32.4650937Z ==============================================================================
2021-09-06T14:10:32.4651373Z Task         : Run Code Analysis
2021-09-06T14:10:32.4651775Z Description  : Run scanner and upload the results to the SonarQube server.
2021-09-06T14:10:32.4652143Z Version      : 4.21.0
2021-09-06T14:10:32.4652433Z Author       : sonarsource
2021-09-06T14:10:32.4653085Z Help         : Version: 4.21.0. This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

[More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
2021-09-06T14:10:32.4653856Z ==============================================================================
2021-09-06T14:10:32.7966040Z [command]C:\Windows\system32\cmd.exe /D /S /C "D:\a\_tasks\SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055\4.21.0\sonar-scanner\bin\sonar-scanner.bat"
2021-09-06T14:10:38.4607567Z INFO: Scanner configuration file: D:\a\_tasks\SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055\4.21.0\sonar-scanner\bin\..\conf\sonar-scanner.properties
2021-09-06T14:10:38.4953108Z INFO: Project root configuration file: NONE
2021-09-06T14:10:39.2786868Z INFO: SonarScanner 4.6.1.2450
2021-09-06T14:10:39.2787936Z INFO: Java 11.0.12 Eclipse Foundation (64-bit)
2021-09-06T14:10:39.2788804Z INFO: Windows Server 2019 10.0 amd64
2021-09-06T14:10:43.5087968Z INFO: User cache: C:\Users\VssAdministrator\.sonar\cache
2021-09-06T14:10:49.8577600Z INFO: Scanner configuration file: D:\a\_tasks\SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055\4.21.0\sonar-scanner\bin\..\conf\sonar-scanner.properties
2021-09-06T14:10:49.8578621Z INFO: Project root configuration file: NONE
2021-09-06T14:10:49.8579086Z INFO: Analyzing on SonarQube server 8.9.1
2021-09-06T14:10:49.8579625Z INFO: Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent)
2021-09-06T14:10:51.1381917Z INFO: Load global settings
2021-09-06T14:10:51.8041331Z INFO: Load global settings (done) | time=666ms
2021-09-06T14:10:51.8155297Z INFO: Server id: 2F08D837-AVmBlVfnrVw_ad0eCrFW
2021-09-06T14:10:51.8156495Z INFO: User cache: C:\Users\VssAdministrator\.sonar\cache
2021-09-06T14:10:51.8189926Z INFO: Load/download plugins
2021-09-06T14:10:51.8190674Z INFO: Load plugins index
2021-09-06T14:10:52.0548470Z INFO: Load plugins index (done) | time=234ms
2021-09-06T14:11:12.8566155Z INFO: Load/download plugins (done) | time=20249ms
2021-09-06T14:11:13.6312419Z INFO: Loaded core extensions: developer-scanner
2021-09-06T14:11:14.0580937Z INFO: JavaScript/TypeScript frontend is enabled
2021-09-06T14:11:14.5018827Z INFO: Process project properties
2021-09-06T14:11:14.5413991Z INFO: Process project properties (done) | time=13ms
2021-09-06T14:11:14.5421814Z INFO: Execute project builders
2021-09-06T14:11:14.5422688Z INFO: Execute project builders (done) | time=2ms
2021-09-06T14:11:14.5423420Z INFO: Project key: ACAIMarket_FordPro_mainDevPortalUI
2021-09-06T14:11:14.5424113Z INFO: Base dir: D:\a\1\s
2021-09-06T14:11:14.5424746Z INFO: Working dir: D:\a\1\s\.scannerwork
2021-09-06T14:11:14.6487573Z INFO: Load project settings for component key: 'ACAIMarket_FordPro_mainDevPortalUI'
2021-09-06T14:11:14.8280715Z INFO: Load project settings for component key: 'ACAIMarket_FordPro_mainDevPortalUI' (done) | time=161ms
2021-09-06T14:11:14.8281836Z INFO: Load project branches
2021-09-06T14:11:14.9261414Z INFO: Load project branches (done) | time=96ms
2021-09-06T14:11:15.8570807Z INFO: Load project pull requests
2021-09-06T14:11:15.8581043Z INFO: Load project pull requests (done) | time=90ms
2021-09-06T14:11:15.8584463Z INFO: Load branch configuration
2021-09-06T14:11:15.8585303Z INFO: Found manual configuration of branch/PR analysis. Skipping automatic configuration.
2021-09-06T14:11:15.8585940Z INFO: Load branch configuration (done) | time=15ms
2021-09-06T14:11:15.8586511Z INFO: Auto-configuring with CI 'Azure DevOps'
2021-09-06T14:11:15.8589497Z INFO: Load quality profiles
2021-09-06T14:11:15.8590052Z INFO: Load quality profiles (done) | time=262ms
2021-09-06T14:11:15.8591024Z INFO: Auto-configuring with CI 'Azure DevOps'
2021-09-06T14:11:15.8591668Z INFO: Load active rules
2021-09-06T14:11:19.9624308Z INFO: Load active rules (done) | time=4469ms
2021-09-06T14:11:19.9997143Z INFO: Branch name: refs/heads/users/PA38/feature_sonarcodecoverage
2021-09-06T14:11:20.1881843Z INFO: suffixes = [.azsk]
2021-09-06T14:11:20.1898900Z INFO: Indexing files...
2021-09-06T14:11:20.1900312Z INFO: Project configuration:
2021-09-06T14:11:20.1918512Z INFO:   Excluded sources: **/*angular*.js, **/*jquery*.js, **/*bootstrap*.js, **/AssemblyInfo.cs, **/knockout*.js, **/tinymce*.js, **/*kendo*.js, **/require.js, **/*jQuery*.js, **/ui-grid*.js, **/select2.js, **/ai*-*.js, **/*MicrosoftAjax*.js, **/*mocha*.js, **/*modernizr*.js, **/moment.min.js, **/*jasmine*.js, **/*chutzpah*.js, **/log4javascript.js, **/moment*.js, **/owl.carousel.min.js, **/Angular.js, **/Scripts/i18n/**, **/d3.js, **tinymce**, **/*bootstrap*.css, **/*bootstrap*.less, **/appSettings.json, **/launchSettings.json, **/tsconfig.spec.json, **/tsconfig.app.json, **/tsconfig.json, **/stylecop.json, **/package-lock.json, **/src/test.ts, **/src/styles.scss, **/src/app/styles/**, **/*.spec.ts
2021-09-06T14:11:20.1922346Z INFO:   Included tests: **/*.spec.ts
2021-09-06T14:11:20.1925044Z INFO:   Excluded sources for coverage: **/src/app/app.component.spec.ts, **/*.spec.ts, **/*.module.ts, **/karma.conf.js, **/src/main.ts, **/src/app/services/**, **/src/environments/**, **/src/app/modules/shared/configs/**, **/src/app/modules/ng-modules/**
2021-09-06T14:11:20.1928130Z INFO:   Excluded sources for duplication: **/*jquery*.js, **/*angular*.js, **/knockout*.js, **/kendo.*.js, **/AssemblyInfo.cs, **/*bootstrap*.*, **/require.js, **/*MicrosoftAjax*.js, **/ui-grid*.js, **/*chutzpah*.js, **/d3.js, **/Scripts/i18n/**
2021-09-06T14:11:22.7308541Z INFO: Load project repositories
2021-09-06T14:11:23.0812635Z INFO: Load project repositories (done) | time=103ms
2021-09-06T14:11:30.1905385Z INFO: 8 files indexed...  (last one was src/FordPro.DevCenter.Web/karma.conf.js)
2021-09-06T14:11:40.1919488Z INFO: 8 files indexed...  (last one was src/FordPro.DevCenter.Web/karma.conf.js)
2021-09-06T14:11:50.1917432Z INFO: 8 files indexed...  (last one was src/FordPro.DevCenter.Web/karma.conf.js)
2021-09-06T14:12:00.1947623Z INFO: 188 files indexed...  (last one was src/FordPro.AdminCenter.Web/src/app/modules/shared/components/invite-user-dialog-data/invite-user-dialog-data.component.spec.ts)
2021-09-06T14:12:10.1939234Z INFO: 188 files indexed...  (last one was src/FordPro.AdminCenter.Web/src/app/modules/shared/components/invite-user-dialog-data/invite-user-dialog-data.component.spec.ts)
2021-09-06T14:12:12.8277535Z INFO: 213 files indexed
2021-09-06T14:12:12.8278758Z INFO: 40512 files ignored because of inclusion/exclusion patterns
2021-09-06T14:12:12.8279539Z INFO: 39654 files ignored because of scm ignore settings
2021-09-06T14:12:12.8538378Z INFO: Quality profile for cs: ServicesSonar-C#
2021-09-06T14:12:12.8546469Z INFO: Quality profile for css: SonarProfile-CSS
2021-09-06T14:12:12.8547638Z INFO: Quality profile for js: SonarProfile-JS
2021-09-06T14:12:12.8548734Z INFO: Quality profile for json: SonarQube-JSON
2021-09-06T14:12:12.8549735Z INFO: Quality profile for ts: Sonar way
2021-09-06T14:12:12.8550588Z INFO: Quality profile for web: SonarProfile-Web
2021-09-06T14:12:12.8551772Z INFO: ------------- Run sensors on module ACAIMarket_mainDevPortalUI_#ACAI
2021-09-06T14:12:13.0811121Z INFO: JavaScript/TypeScript frontend is enabled
2021-09-06T14:12:13.0814522Z INFO: Load metrics repository
2021-09-06T14:12:13.1732299Z INFO: Load metrics repository (done) | time=99ms
2021-09-06T14:12:13.3505027Z WARNING: An illegal reflective access operation has occurred
2021-09-06T14:12:13.3506628Z WARNING: Illegal reflective access by net.sf.cglib.core.ReflectUtils$1 (file:/C:/Users/VssAdministrator/.sonar/cache/aa85aa56a6e779d73ae7349de9dcff7e/sonar-JSON-plugin.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
2021-09-06T14:12:13.3509018Z WARNING: Please consider reporting this to the maintainers of net.sf.cglib.core.ReflectUtils$1
2021-09-06T14:12:13.3509873Z WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
2021-09-06T14:12:13.3510677Z WARNING: All illegal access operations will be denied in a future release
2021-09-06T14:12:15.8394553Z INFO: Sensor CSS Metrics [cssfamily]
2021-09-06T14:12:15.8952493Z INFO: Sensor CSS Metrics [cssfamily] (done) | time=71ms
2021-09-06T14:12:15.8954755Z INFO: Sensor JSON Squid Sensor [JSON]
2021-09-06T14:12:15.8956092Z INFO: 4 source files to be analyzed
2021-09-06T14:12:16.0488315Z INFO: Sensor JSON Squid Sensor [JSON] (done) | time=108ms
2021-09-06T14:12:16.2905482Z INFO: Sensor C# Project Type Information [csharp]
2021-09-06T14:12:16.3343461Z INFO: Sensor C# Project Type Information [csharp] (done) | time=2ms
2021-09-06T14:12:16.4281923Z INFO: Sensor C# Properties [csharp]
2021-09-06T14:12:16.4801827Z INFO: Sensor C# Properties [csharp] (done) | time=1ms
2021-09-06T14:12:16.4802951Z INFO: Sensor HTML [web]
2021-09-06T14:12:16.4803620Z INFO: 4/4 source files have been analyzed
2021-09-06T14:12:16.6754984Z INFO: Sensor HTML [web] (done) | time=651ms
2021-09-06T14:12:16.6826315Z INFO: Sensor VB.NET Project Type Information [vbnet]
2021-09-06T14:12:16.6890711Z INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=1ms
2021-09-06T14:12:16.6895594Z INFO: Sensor VB.NET Properties [vbnet]
2021-09-06T14:12:16.6896736Z INFO: Sensor VB.NET Properties [vbnet] (done) | time=1ms
2021-09-06T14:12:16.6897383Z INFO: Sensor JaCoCo XML Report Importer [jacoco]
2021-09-06T14:12:16.6898253Z INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
2021-09-06T14:12:16.6899247Z INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
2021-09-06T14:12:16.6899930Z INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=7ms
2021-09-06T14:12:16.6900554Z INFO: Sensor JavaScript analysis [javascript]
2021-09-06T14:12:21.7558479Z INFO: Deploying custom rules bundle jar:file:/C:/Users/VssAdministrator/.sonar/cache/1c0d0d6d358b2ff25a27998c60079e2e/sonar-securityjsfrontend-plugin.jar!/js-vulnerabilities-rules-1.0.0.tgz to D:\a\1\s\.scannerwork\.sonartmp\eslint-bridge-bundle\package\custom-rules10294655379020661497
2021-09-06T14:12:24.9996061Z INFO: 1 source file to be analyzed
2021-09-06T14:12:26.9101382Z INFO: 1/1 source file has been analyzed
2021-09-06T14:12:26.9102442Z INFO: Sensor JavaScript analysis [javascript] (done) | time=10247ms
2021-09-06T14:12:26.9103099Z INFO: Sensor TypeScript analysis [javascript]
2021-09-06T14:12:27.6102635Z INFO: Found 3 tsconfig.json file(s): [D:\a\1\s\src\FordPro.AdminCenter.Web\tsconfig.json, D:\a\1\s\src\FordPro.DevCenter.Web\tsconfig.json, D:\a\1\s\src\FordPro.Marketplace.Web\tsconfig.json]
2021-09-06T14:12:29.2643881Z INFO: Analyzing 42 files using tsconfig: D:\a\1\s\src\FordPro.DevCenter.Web\tsconfig.json
2021-09-06T14:12:29.2644667Z INFO: 42 source files to be analyzed
2021-09-06T14:12:37.7105928Z INFO: 14/42 files analyzed, current file: src/FordPro.DevCenter.Web/src/app/modules/shared/configs/auth-config.ts
2021-09-06T14:12:39.5529659Z INFO: 42/42 source files have been analyzed
2021-09-06T14:12:39.5531242Z INFO: Sensor TypeScript analysis [javascript] (done) | time=12631ms
2021-09-06T14:12:39.5532945Z INFO: Sensor JavaScript/TypeScript Coverage [javascript]
2021-09-06T14:12:39.5533992Z WARN: The use of sonar.typescript.lcov.reportPaths for coverage import is deprecated, use sonar.javascript.lcov.reportPaths instead.
2021-09-06T14:12:39.5535054Z INFO: Analysing [D:\a\1\BuildLogFolder\TestResults\src\FordPro.DevCenter.Web\coverage\FordPro\lcov.info]
2021-09-06T14:12:39.5832513Z WARN: Could not resolve 1 file paths in [D:\a\1\BuildLogFolder\TestResults\src\FordPro.DevCenter.Web\coverage\FordPro\lcov.info]
2021-09-06T14:12:39.5834903Z WARN: First unresolved path: src\test.ts (Run in DEBUG mode to get full list of unresolved paths)
2021-09-06T14:12:39.5835824Z INFO: Sensor JavaScript/TypeScript Coverage [javascript] (done) | time=40ms
2021-09-06T14:12:39.5836546Z INFO: Sensor ThymeLeaf template sensor [securityjavafrontend]
2021-09-06T14:12:39.5837340Z INFO: javasecurity:S5131 is not activated in quality profile: skipping execution of thymeleaf sensor.
2021-09-06T14:12:39.5838735Z INFO: Sensor ThymeLeaf template sensor [securityjavafrontend] (done) | time=0ms
2021-09-06T14:12:39.5839375Z INFO: Sensor Generic Test Executions Report
2021-09-06T14:12:39.5840032Z INFO: Parsing D:\a\1\BuildLogFolder\TestResults\src\FordPro.DevCenter.Web\testresults\unittest\unit-test-result.xml
2021-09-06T14:12:39.7594597Z INFO: Imported test execution data for 0 files
2021-09-06T14:12:39.7595706Z INFO: **Test execution data ignored for 17 unknown files, including:**
2021-09-06T14:12:39.7596411Z src/app/modules/header/componenents/documentation/documentation.component.spec.ts
2021-09-06T14:12:39.7597196Z src/app/services/my-account.service.spec.ts
2021-09-06T14:12:39.7597942Z src/app/modules/landing-page/components/landing-page/landing-page.component.spec.ts
2021-09-06T14:12:39.7598656Z src/app/services/localstorage.service.spec.ts
2021-09-06T14:12:39.7599295Z src/app/modules/my-account/components/marketplace-listing/marketplace-listing.component.spec.ts
2021-09-06T14:12:39.7601007Z INFO: Sensor Generic Test Executions Report (done) | time=170ms
2021-09-06T14:12:39.7601776Z INFO: Sensor JavaSecuritySensor [security]
2021-09-06T14:12:39.7602541Z INFO: Reading type hierarchy from: D:\a\1\s\.scannerwork\ucfg2\java
2021-09-06T14:12:39.7603593Z INFO: Read 0 type definitions
2021-09-06T14:12:39.7604532Z INFO: Reading UCFGs from: D:\a\1\s\.scannerwork\ucfg2\java
2021-09-06T14:12:39.7605116Z INFO: No UCFGs have been included for analysis.
2021-09-06T14:12:39.7605668Z INFO: Sensor JavaSecuritySensor [security] (done) | time=4ms
2021-09-06T14:12:39.7606191Z INFO: Sensor CSharpSecuritySensor [security]
2021-09-06T14:12:39.7606931Z INFO: Reading type hierarchy from: D:\a\1\s\ucfg_cs2
2021-09-06T14:12:39.7607471Z INFO: Read 0 type definitions
2021-09-06T14:12:39.7607982Z INFO: Reading UCFGs from: D:\a\1\s\ucfg_cs2
2021-09-06T14:12:39.7608650Z INFO: No UCFGs have been included for analysis.
2021-09-06T14:12:39.7609264Z INFO: Sensor CSharpSecuritySensor [security] (done) | time=2ms
2021-09-06T14:12:39.7610183Z INFO: Sensor PhpSecuritySensor [security]
2021-09-06T14:12:39.7611175Z INFO: Reading type hierarchy from: D:\a\1\s\.scannerwork\ucfg2\php
2021-09-06T14:12:39.7611806Z INFO: Read 0 type definitions
2021-09-06T14:12:39.7612431Z INFO: Reading UCFGs from: D:\a\1\s\.scannerwork\ucfg2\php
2021-09-06T14:12:39.7613237Z INFO: No UCFGs have been included for analysis.
2021-09-06T14:12:39.7614221Z INFO: Sensor PhpSecuritySensor [security] (done) | time=0ms
2021-09-06T14:12:39.7614971Z INFO: Sensor PythonSecuritySensor [security]
2021-09-06T14:12:39.7615551Z INFO: Reading type hierarchy from: D:\a\1\s\.scannerwork\ucfg2\python
2021-09-06T14:12:39.7616117Z INFO: Read 0 type definitions
2021-09-06T14:12:39.7616834Z INFO: Reading UCFGs from: D:\a\1\s\.scannerwork\ucfg2\python
2021-09-06T14:12:39.7617583Z INFO: No UCFGs have been included for analysis.
2021-09-06T14:12:39.7618367Z INFO: Sensor PythonSecuritySensor [security] (done) | time=1ms
2021-09-06T14:12:39.7619053Z INFO: Sensor JsSecuritySensor [security]
2021-09-06T14:12:39.7620019Z INFO: Reading type hierarchy from: D:\a\1\s\.scannerwork\ucfg2\js
2021-09-06T14:12:39.7898033Z INFO: Read 0 type definitions
2021-09-06T14:12:39.7899143Z INFO: Reading UCFGs from: D:\a\1\s\.scannerwork\ucfg2\js
2021-09-06T14:12:40.1161152Z INFO: 14:12:40.0188506 Building Runtime Type propagation graph
2021-09-06T14:12:40.1163378Z INFO: 14:12:40.0488542 Running Tarjan on 750 nodes
2021-09-06T14:12:40.1166318Z INFO: 14:12:40.0568539 Tarjan found 750 components
2021-09-06T14:12:40.1167136Z INFO: 14:12:40.0678543 Variable type analysis: done
2021-09-06T14:12:40.1167878Z INFO: 14:12:40.0688535 Building Runtime Type propagation graph
2021-09-06T14:12:40.1168711Z INFO: 14:12:40.0918524 Running Tarjan on 750 nodes
2021-09-06T14:12:40.1169628Z INFO: 14:12:40.0938606 Tarjan found 750 components
2021-09-06T14:12:40.1170390Z INFO: 14:12:40.0958518 Variable type analysis: done
2021-09-06T14:12:40.1171094Z INFO: Analyzing 124 ucfgs to detect vulnerabilities.
2021-09-06T14:12:40.6016776Z INFO: rule: S5147, entrypoints: 43
2021-09-06T14:12:40.6021325Z INFO: Running symbolic analysis
2021-09-06T14:12:41.7584681Z INFO: rule: S5147 done
2021-09-06T14:12:41.8702816Z INFO: rule: S3649, entrypoints: 43
2021-09-06T14:12:42.0854539Z INFO: Running symbolic analysis
2021-09-06T14:12:42.6384844Z INFO: rule: S3649 done
2021-09-06T14:12:42.7304890Z INFO: rule: S5334, entrypoints: 43
2021-09-06T14:12:42.7314384Z INFO: Running symbolic analysis
2021-09-06T14:12:42.7316867Z INFO: rule: S5334 done
2021-09-06T14:12:42.7318682Z INFO: rule: S6105, entrypoints: 43
2021-09-06T14:12:42.7319422Z INFO: Running symbolic analysis
2021-09-06T14:12:42.7320036Z INFO: rule: S6105 done
2021-09-06T14:12:42.7320703Z INFO: rule: S5696, entrypoints: 43
2021-09-06T14:12:42.7321366Z INFO: Running symbolic analysis
2021-09-06T14:12:42.8850562Z INFO: rule: S5696 done
2021-09-06T14:12:43.1113513Z INFO: rule: S2076, entrypoints: 43
2021-09-06T14:12:43.1115554Z INFO: Running symbolic analysis
2021-09-06T14:12:43.1988727Z INFO: rule: S2076 done
2021-09-06T14:12:43.4504022Z INFO: rule: S5131, entrypoints: 43
2021-09-06T14:12:43.5637148Z INFO: Running symbolic analysis
2021-09-06T14:12:43.6131387Z INFO: rule: S5131 done
2021-09-06T14:12:43.6295419Z INFO: rule: S5144, entrypoints: 43
2021-09-06T14:12:43.6298078Z INFO: Running symbolic analysis
2021-09-06T14:12:43.6299106Z INFO: rule: S5144 done
2021-09-06T14:12:43.6299907Z INFO: rule: S2083, entrypoints: 43
2021-09-06T14:12:43.6300603Z INFO: Running symbolic analysis
2021-09-06T14:12:43.6301715Z INFO: rule: S2083 done
2021-09-06T14:12:43.6302507Z INFO: rule: S5146, entrypoints: 43
2021-09-06T14:12:43.6303336Z INFO: Running symbolic analysis
2021-09-06T14:12:43.6303995Z INFO: rule: S5146 done
2021-09-06T14:12:43.6304602Z INFO: rule: S6096, entrypoints: 43
2021-09-06T14:12:43.6305243Z INFO: Running symbolic analysis
2021-09-06T14:12:43.6305885Z INFO: rule: S6096 done
2021-09-06T14:12:43.6306491Z INFO: rule: S2631, entrypoints: 43
2021-09-06T14:12:43.6307135Z INFO: Running symbolic analysis
2021-09-06T14:12:43.6307750Z INFO: rule: S2631 done
2021-09-06T14:12:43.6308377Z INFO: rule: S5883, entrypoints: 43
2021-09-06T14:12:43.6308994Z INFO: Running symbolic analysis
2021-09-06T14:12:43.6309603Z INFO: rule: S5883 done
2021-09-06T14:12:43.6310383Z INFO: Sensor JsSecuritySensor [security] (done) | time=3804ms
2021-09-06T14:12:43.6311275Z INFO: ------------- Run sensors on project
2021-09-06T14:12:43.8317046Z INFO: Sensor C# [csharp]
2021-09-06T14:12:43.8398345Z WARN: Your project contains C# files which cannot be analyzed with the scanner you are using. To analyze C# or VB.NET, you must use the SonarScanner for .NET 5.x or higher, see https://redirect.sonarsource.com/doc/install-configure-scanner-msbuild.html
2021-09-06T14:12:43.8534254Z INFO: Sensor C# [csharp] (done) | time=1ms
2021-09-06T14:12:43.8848935Z INFO: Sensor Component Governance Report Importer [panorama]
2021-09-06T14:12:43.8857925Z INFO: **************************************************************************
2021-09-06T14:12:43.8915303Z INFO: Component Governance Sensor execution started
2021-09-06T14:12:44.8754923Z INFO: Component Governance skipped : Component Governance task is disabled in ServicesDevOps Panorama Config
2021-09-06T14:12:44.8756006Z INFO: Add 'ServicesSonar Panorama Config' task in build pipeline and enable Component Governance check box.
2021-09-06T14:12:54.9107516Z INFO: Sensor Component Governance Report Importer [panorama] (done) | time=11114ms
2021-09-06T14:12:54.9108635Z INFO: Sensor CSRF Report Importer [panorama]
2021-09-06T14:12:54.9109373Z INFO: **************************************************************************
2021-09-06T14:12:54.9109983Z INFO: CsrfSensor --> execute started
2021-09-06T14:12:54.9126191Z INFO: Properties file does not exists in default working directory
2021-09-06T14:12:54.9130745Z INFO: Sensor CSRF Report Importer [panorama] (done) | time=1ms
2021-09-06T14:12:54.9134237Z INFO: Sensor Application Inspector Report Importer [panorama]
2021-09-06T14:12:54.9135138Z INFO: *********************************************************
2021-09-06T14:12:54.9136230Z INFO: Application Inspector Sensor started
2021-09-06T14:12:54.9136806Z INFO: Properties file does not exists in default working directory
2021-09-06T14:12:54.9137697Z INFO: Sensor Application Inspector Report Importer [panorama] (done) | time=0ms
2021-09-06T14:12:54.9269920Z INFO: Sensor CredScan Report Importer [panorama]
2021-09-06T14:12:54.9271369Z INFO: **************************************************************************
2021-09-06T14:12:54.9273664Z INFO: CredScanSensor execution started
2021-09-06T14:12:54.9274375Z INFO: Properties file does not exists in default working directory
2021-09-06T14:12:54.9275238Z INFO: Sensor CredScan Report Importer [panorama] (done) | time=1ms
2021-09-06T14:12:54.9275820Z INFO: Sensor Zero Coverage Sensor
2021-09-06T14:12:54.9276527Z INFO: Sensor Zero Coverage Sensor (done) | time=5ms
2021-09-06T14:12:54.9771056Z INFO: SCM Publisher SCM provider for this project is: git
2021-09-06T14:12:54.9780891Z INFO: SCM Publisher 16 source files to be analyzed
2021-09-06T14:12:55.7407611Z INFO: SCM Publisher 15/16 source files have been analyzed (done) | time=750ms
2021-09-06T14:12:55.7409775Z WARN: Missing blame information for the following files:
2021-09-06T14:12:55.7412379Z WARN:   * src/FordPro.DevCenter.Web/package.json
2021-09-06T14:12:55.7414553Z WARN: This may lead to missing/broken features in SonarQube
2021-09-06T14:12:55.7416881Z INFO: CPD Executor 23 files had no CPD blocks
2021-09-06T14:12:55.7800807Z INFO: CPD Executor Calculating CPD for 35 files
2021-09-06T14:12:55.7813204Z INFO: CPD Executor CPD calculation finished (done) | time=41ms
2021-09-06T14:12:55.7890764Z INFO: Load New Code definition
2021-09-06T14:12:55.8800438Z INFO: Load New Code definition (done) | time=89ms
2021-09-06T14:12:56.0706355Z INFO: Analysis report generated in 259ms, dir size=412 KB
2021-09-06T14:12:56.2996056Z INFO: Analysis report compressed in 234ms, zip size=179 KB
2021-09-06T14:12:56.5973446Z INFO: Analysis report uploaded in 240ms
2021-09-06T14:12:56.5977324Z INFO: ANALYSIS SUCCESSFUL, you can browse https://servicessonar.corp.microsoft.com/dashboard?id=ACAIMarket_FordPro_mainDevPortalUI&branch=refs%2Fheads%2Fusers%2FPA38%2Ffeature_sonarcodecoverage
2021-09-06T14:12:56.5979318Z INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
2021-09-06T14:12:56.5980456Z INFO: More about the report processing at https://servicessonar.corp.microsoft.com/api/ce/task?id=AXu7dHPChyZzqk0rTyvu
2021-09-06T14:13:02.9944788Z INFO: Analysis total time: 1:49.363 s
2021-09-06T14:13:02.9985848Z INFO: ------------------------------------------------------------------------
2021-09-06T14:13:02.9986878Z INFO: EXECUTION SUCCESS
2021-09-06T14:13:02.9987833Z INFO: ------------------------------------------------------------------------
2021-09-06T14:13:02.9988578Z INFO: Total time: 2:24.635s
2021-09-06T14:13:03.2030535Z INFO: Final Memory: 58M/197M
2021-09-06T14:13:03.2031453Z INFO: ------------------------------------------------------------------------
2021-09-06T14:13:03.3799824Z ##[section]Finishing: Complete the SonarQube analysis

Below are the YAML Snippet:

#Prepare the SonarQube analysis Task

- task: SonarSource.sonarqube.15B84CA1-B62F-4A2A-A403-89B77A063157.SonarQubePrepare@4
  displayName: 'Prepare the SonarQube analysis'
  inputs:
    SonarQube: 'ServicesCODE-PROD'
    scannerMode: CLI
    configMode: manual
    cliProjectKey: 'ACAIMarket_FordPro_mainDevPortalUI'
    cliProjectName: 'ACAIMarket_mainDevPortalUI_#ACAI'
    cliProjectVersion: '$(Build.BuildNumber)'
    extraProperties: |
      sonar.branch.name=$(Build.SourceBranch) 
      sonar.sources=$(Build.SourcesDirectory)/src/FordPro.DevCenter.Web
      sonar.tests=src
      sonar.test.inclusions=**/*.spec.ts
      sonar.typescript.lcov.reportpaths
sonar.typescript.lcov.reportPaths=$(Agent.BuildDirectory)/BuildLogFolder/TestResults/src/FordPro.DevCenter.Web/coverage/FordPro/lcov.info
sonar.testExecutionReportPaths=$(Agent.BuildDirectory)/BuildLogFolder/TestResults/src/FordPro.DevCenter.Web/testresults/unittest/unit-test-result.xml

Please help to resolve the issues.

Regards,
prabhu

Anyone please help me to resolve my query.

Hello @prabhu051294 , as of August 16th the property for typescript coverage got deprecated in favor of sonar.javascript.lcov.reportPaths .You can read more about coverage in our documentation.

Please, let us know if that works or if there’s anything else we can help you with!

Best regards,
Antonio

Hi @Antonio_Garcia ,

I tried but I am unable to see the Test case in SonarQube. I attached the logs with YAML task.


INFO: Sensor ThymeLeaf template sensor [securityjavafrontend] (done) | time=0ms
INFO: Sensor Generic Test Executions Report
INFO: Parsing D:\a\1\BuildLogFolder\TestResults\src\FordPro.Marketplace.Web\testresults\unittest\unit-test-result.xml
INFO: **Imported test execution data for 0 files**
INFO: Test execution data ignored for 6 unknown files, including:
src/app/modules/landing-page/components/landing-page/landing-page.component.spec.ts
src/app/modules/dashboard/dashboard.component.spec.ts
src/app/modules/footer/components/privacy/privacy.component.spec.ts
src/app/app.component.spec.ts
src/app/modules/shared/components/logout/logout.component.spec.ts
INFO: Sensor Generic Test Executions Report (done) | time=100ms

YAML Task:

- task: SonarSource.sonarqube.15B84CA1-B62F-4A2A-A403-89B77A063157.SonarQubePrepare@4
  displayName: 'Prepare the SonarQube analysis'
  inputs:
    SonarQube: 'ServicesCODE-PROD'
    scannerMode: CLI
    configMode: manual
    cliProjectKey: 'ACAIMarket_FordPro_mainMarketplacelUI'
    cliProjectName: 'ACAIMarket_mainMarketplaceUI_#ACAI'
    cliProjectVersion: '$(Build.BuildNumber)'
    extraProperties: |
      sonar.branch.name=$(Build.SourceBranch)
      sonar.sources=$(Build.SourcesDirectory)/src/FordPro.Marketplace.Web
      sonar.exclusions=$(SonarExclusionMarketplaceUI)
      sonar.coverage.exclusions=$(SonarCoverageExclusionMarketplaceUI)
      SONAR_SCANNER_OPTS=-Xmx2048m
      sonar.tests=$(Build.SourcesDirectory)/src/FordPro.Marketplace.Web/src
      sonar.test.inclusions=**/*.spec.ts
      sonar.testExecutionReportPaths=$(Agent.BuildDirectory)/BuildLogFolder/TestResults/src/FordPro.Marketplace.Web/testresults/unittest/unit-test-result.xml
sonar.javascript.lcov.reportPaths=$(Agent.BuildDirectory)/BuildLogFolder/TestResults/src/FordPro.Marketplace.Web/coverage/FordPro/lcov.info

Please help me to resolve this.

Regards,
Prabhu

Hi,

Does Karma output its results in the Generic Test Execution format? If not, that could explain the problem. If it does, then it’s probably down to pathing as hinted in your original logs:

Is analysis triggered from a directory that contains src/app/modules/[and so on]?

 
Ann

Hi @ganncamp ,

Yes Karam Output Results in Generic Test Execution Format. Same I was trying with Localhost Sonarqube, Its working fine and I am able to see Test Case in Sonarqube. Same while I was trying with Sonarcloud its not publishing the Test Results. Yes analysis triggered from src/app/modules/[and so on]. Test Result Xml file also attached for reference.

<testExecutions version="1">
  <file path="src/app/modules/landing-page/components/landing-page/landing-page.component.spec.ts">
    <testCase name="LandingPageComponent ngOnInit makes expected calls" duration="75"/>
    <testCase name="LandingPageComponent can load instance" duration="5"/>
    <testCase name="LandingPageComponent loginDisplay has default value" duration="4"/>
  </file>
  <file path="src/app/app.component.spec.ts">
    <testCase name="AppComponent ngOnInit makes expected calls" duration="12"/>
    <testCase name="AppComponent can load instance" duration="4"/>
    <testCase name="AppComponent loginDisplay has default value" duration="5"/>
    <testCase name="AppComponent title has default value" duration="4"/>
    <testCase name="AppComponent isIframe has default value" duration="3"/>
  </file>
  <file path="src/app/modules/my-account/components/profile/profile.component.spec.ts">
    <testCase name="ProfileComponent ngOnInit makes expected calls" duration="9"/>
    <testCase name="ProfileComponent getProfile makes expected calls" duration="4"/>
    <testCase name="ProfileComponent can load instance" duration="3"/>
  </file>
  <file path="src/app/services/localstorage.service.spec.ts">
    <testCase name="LocalstorageService can load instance" duration="2"/>
  </file>
  <file path="src/app/modules/core/components/menu/menu.component.spec.ts">
    <testCase name="MenuComponent can load instance" duration="37"/>
    <testCase name="MenuComponent signOut makes expected calls" duration="15"/>
  </file>
  <file path="src/app/services/home.service.spec.ts">
    <testCase name="HomeService should be created" duration="3"/>
  </file>
  <file path="src/app/modules/landing-page/components/bill-board/bill-board.component.spec.ts">
    <testCase name="BillBoardComponent should create" duration="10"/>
  </file>
  <file path="src/app/modules/core/components/footer/footer.component.spec.ts">
    <testCase name="FooterComponent should create" duration="8"/>
  </file>
  <file path="src/app/modules/core/components/header/header.component.spec.ts">
    <testCase name="HeaderComponent should create" duration="23"/>
  </file>
  <file path="src/app/modules/my-account/components/marketplace-listing/marketplace-listing.component.spec.ts">
    <testCase name="MarketplaceListingComponent should create" duration="5"/>
  </file>
  <file path="src/app/modules/header/componenents/documentation/documentation.component.spec.ts">
    <testCase name="DocumentationComponent should create" duration="4"/>
  </file>
  <file path="src/app/modules/footer/components/privacy/privacy.component.spec.ts">
    <testCase name="PrivacyComponent should create" duration="5"/>
  </file>
  <file path="src/app/modules/my-account/components/my-account/my-account.component.spec.ts">
    <testCase name="MyAccountComponent should create" duration="5"/>
  </file>
  <file path="src/app/modules/footer/components/terms-and-conditions/terms-and-conditions.component.spec.ts">
    <testCase name="TermsAndConditionsComponent should create" duration="5"/>
  </file>
  <file path="src/app/services/my-account.service.spec.ts">
    <testCase name="MyAccountService should be created" duration="2"/>
  </file>
  <file path="src/app/modules/my-account/components/telematics/telematics.component.spec.ts">
    <testCase name="TelematicsComponent should create" duration="3"/>
  </file>
  <file path="src/app/modules/shared/components/logout/logout.component.spec.ts">
    <testCase name="LogoutComponent ngOnInit makes expected calls" duration="4"/>
    <testCase name="LogoutComponent can load instance" duration="2"/>
  </file>
</testExecutions>

Please help me to resolve ASAP.

Regards,
Prabhu

Hi Prabhu,

Since this works in one environment and not in others, I guess it’s going to be down to the differences among those environments.

And to make sure, you are producing the reports consumed by each environment in those environments, right?

 
Ann

Hi @ganncamp ,

Yes We have multiple environments(Dev, QA and Prod). For Every Environments we are publishing the Code Coverage and Unit Test Results. Code Coverage is showing but Unit Test Case are not showing in Sonar.

Please help me to resolve ASAP.

Regards,
Prabhu

Hi Prabhu,

Was your issue related to Unit Test result no showing resolved?
If yes, what was done I am facing the similar issue?