简体   繁体   中英

Exclude files in Sonar Code Coverage Analysis Test - Angular 7

How do I exclude ts.files in SonarQube Analysis for better Code Coverage.

I tried with with below code

"test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "karmaConfig": "src/karma.conf.js",
            "codeCoverageExclude": [
              "src/app/user/about-report/about-report.component.ts"
            ],
          }
       }

But no luck its is getting analized in sonar. Can you help me out. I am using Angular 7.

sonar-project.properties ,尝试添加如下内容:

sonar.exclusions= **/*.spec.ts, **/*.ts, src/test/*

There is the following directive that can be used in the sonar-project.properties file:

sonar.coverage.exclusions=src/main/webapp

Or via website, go to Administration > General Settings > Analysis Scope > Code Coverage and set the Coverage Exclusions property

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM