angular / angular/angular-cli

SchematicTestRunner.callRule does not use the logger by default

未關閉
#12,087 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
area: @angular-devkit/schematics effort1: easy (hours) type: bug/fix
主要語言
TypeScript
星號
27k
分支
11.8k
平均合併
14 小時 23 分鐘
30 天內合併 PR
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 摘要。