简体   繁体   English

在声纳代码覆盖率分析测试中排除文件 - Angular 7

[英]Exclude files in Sonar Code Coverage Analysis Test - Angular 7

How do I exclude ts.files in SonarQube Analysis for better Code Coverage.如何在 SonarQube 分析中排除 ts.files 以获得更好的代码覆盖率。

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.我正在使用 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-project.properties文件中使用以下指令:

sonar.coverage.exclusions=src/main/webapp

Or via website, go to Administration > General Settings > Analysis Scope > Code Coverage and set the Coverage Exclusions property或者通过网站,转到管理 > 常规设置 > 分析范围 > 代码覆盖率并设置覆盖排除属性

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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