SchematicTestRunner.callRule does not use the logger by default
- 主要语言
- 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