ng test: Collect total code coverage in multi project repository

未关闭
#11,268 6 条评论 29 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
angular, typescript
领域
cli, testing

调研方向

首先使用 ng test 重现多项目 workspace 的情况,然后检查 application 和 library schematics 下引用的 karma.conf.js 文件。跟踪 coverage 的处理应归属于 builder 还是 schematic;完成的标准是每个项目都有自己的 lcov 数据,并且组合报告能够表示总体 coverage。

由索引模型根据 Issue 内容生成。

描述

area: @angular-devkit/build-angular devkit/build-angular:karma feature feature: under consideration
Bug Report or Feature Request (mark with an x)
- [ ] bug report -> please search issues before submitting
- [x] feature request
Area
- [x] devkit
- [ ] schematics
Versions
Angular CLI: 6.0.8
Node: 8.9.1
OS: win32 x64
Angular: 5.2.11
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.8
@angular-devkit/build-angular     0.6.8
@angular-devkit/build-optimizer   0.6.8
@angular-devkit/core              0.6.8
@angular-devkit/schematics        0.6.8
@angular/cdk                      5.2.5
@angular/cli                      6.0.8
@ngtools/json-schema              1.1.0
@ngtools/webpack                  6.0.8
@schematics/angular               0.6.1
@schematics/update                0.6.8
ng-packagr                        3.0.2
rxjs                              6.2.1
typescript                        2.6.2
webpack                           4.8.3
Repro steps

Multi project workspace, run ng test to test all projects.

The log given by the failure

Produced coverage report in coverage/lcov.info only contains results for the last run code coverage.

HTML reports are stored per project in coverage/<project>.

Desired functionality

Write indivudual lcovs per project, e.g, coverage/<project>/lcov.info, allowing users to get a total code coverage for the whole project.

Alternative would be functionality similar to istanbul-combine. Write coverage.json for each project and write a combined coverage report and end of test runs.

Mention any other details that might be useful

Should eht changes be made in the builder or in the schematic?

https://github.com/angular/angular-cli/blob/master/packages/schematics/angular/library/files/__projectRoot__/karma.conf.js#L19

https://github.com/angular/angular-cli/blob/master/packages/schematics/angular/application/files/root/karma.conf.js#L19

主要语言
TypeScript
星标
27k
派生
11.8k
平均合并
16 小时 35 分钟
30 天内合并 PR
176

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

angular/angular-cli 的其他 Issue

查看 angular/angular-cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。