Unit Test Number not appearing in Angular Project

Hello everyone ,

I was just wondering - ever since sonar cloud got the new UI my Unit test number is not appearing anymore in the my overview page.

I am using an angular project version 13 and this is my karma configuration

// 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('@angular-devkit/build-angular/plugins/karma'),
            require('karma-sonarqube-unit-reporter'),
        ],
        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
        },
        jasmineHtmlReporter: {
            suppressAll: true, // removes the duplicated traces
        },
        coverageReporter: {
            dir: require('path').join(__dirname, './coverage'),
            reporters: [{ type: 'lcov', subdir: 'report-lcov' }],
        },
        sonarQubeUnitReporter: {
            sonarQubeVersion: 'LATEST',
            outputFile: 'reports/test-report.xml',
            overrideTestDescription: true,
            testPaths: ['src'],
            testFilePattern: '.spec.ts',
            useBrowserName: false,
        },
        reporters: ['progress', 'kjhtml', 'coverage', 'sonarqubeUnit'],
        port: 9876,
        colors: true,
        logLevel: config.LOG_INFO,
        autoWatch: true,
        browsers: ['Chrome'],
        singleRun: false,
        restartOnFileChange: true,
        customLaunchers: {
            ChromeHeadlessCI: {
                base: 'ChromeHeadless',
                flags: ['--no-sandbox'],
            },
        },
    });
};

My sonar properties config

#sonar project key
sonar.projectKey=itxi_ta-web-app
sonar.organization=itxi-aero
sonar.sources=.
sonar.host.url=https://sonarcloud.io/
sonar.login=6c162168ac09723b3a3512199a73476a987c3953
#coverage report directory
sonar.javascript.lcov.reportPaths=coverage/report-lcov/lcov.info
#unit test report generator
sonar.testExecutionReportPaths=reports/test-report.xml
sonar.tests=.
sonar.test.inclusions = **/*.spec.ts
# sonar.branch.name=branch-v2.0.0
# sonar.projectVersion=2.0.0

For some reason it is not showing anymore in sonar cloud even tho all files and report are being generate correctly can someone help !

Hey there.

Unit Tests are indeed no longer found on the dashboard. You can make sure the results are still being imported by browsing to the Measures tab and looking under Coverage.

1 Like

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