angular / angular/angular-cli

ng test: Collect total code coverage in multi project repository

オープン
#11,268 コメント 6 件 リアクション 29 件 担当者 0 名 GitHub で見る
area: @angular-devkit/build-angular devkit/build-angular:karma feature feature: under consideration
主要言語
TypeScript
スター
27k
フォーク
11.8k
平均マージ
14時間 23分
マージ済み PR(30日)
162

説明

### 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/`.

### Desired functionality

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

Alternative would be functionality similar to [istanbul-combine](https://github.com/jamestalmage/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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず `ng test` を使ってマルチプロジェクト workspace のケースを再現し、次に application および library schematics 配下の、参照されている `karma.conf.js` ファイルを調べます。coverage の処理が builder と schematic のどちらに属するのかを追跡します。完了の条件は、各プロジェクトが独自の lcov データを持ち、結合されたレポートで合計 coverage を表現できることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
cli, testing
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。