angular / angular/angular-cli

SchematicTestRunner.callRule does not use the logger by default

オープン
#12,087 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
area: @angular-devkit/schematics effort1: easy (hours) type: bug/fix
主要言語
TypeScript
スター
27k
フォーク
11.8k
平均マージ
14時間 23分
マージ済み PR(30日)
162

説明

_From @FrozenPandaz on June 6, 2018 3:12_

### Bug Report or Feature Request (mark with an `x`)
```
- [x] bug report -> please search issues before submitting
- [ ] feature request
```

### Area
```
- [x] devkit
- [ ] schematics
```

### Versions

Ubuntu

### Repro steps

```ts

const schematicRunner = new SchematicTestRunner(
collectionName,
pathToCollectionJson
);
const spy = spyOn(schematicRunner.logger, 'info');
schematicRunner
.callRule((host: Tree, context: SchematicContext) => {
context.logger.info('Hello world!');
, Tree.empty())
.subscribe(result => {
expect(spy).toHaveBeenCalledWith('Hello world!');
});
```
### The log given by the failure

Expected spy to have been called 'Hello world!' but was not called.

### Desired functionality

The SchematicTestRunner logger should be used by default and the test should pass

### Mention any other details that might be useful

Any unit tests which test rules

_Copied from original issue: angular/devkit#1016_

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

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

調査の方向性

SchematicTestRunner.callRule から始めて、その logger がルールコンテキストにどのように提供されるかを追跡します。ルールの単体テストを確認して、示されている例を再現し、runner の logger がデフォルトで “Hello world!” を受け取ることを確認します。

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

評価

技術スタック
typescript
領域
testing
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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