angular / angular/angular-cli

SchematicTestRunner.callRule does not use the logger by default

Abierto
#12,087 0 comentarios 0 reacciones 0 asignados Ver en GitHub
area: @angular-devkit/schematics effort1: easy (hours) type: bug/fix
Lenguaje dominante
TypeScript
Estrellas
27k
Forks
11.8k
Merge medio
14 h 23 min
PR fusionados (30 d)
162

Descripción

_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_

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza en SchematicTestRunner.callRule y sigue cómo se proporciona su logger al contexto de la regla. Revisa las pruebas unitarias de las reglas y reproduce el ejemplo mostrado; luego verifica que el logger del runner reciba “Hello world!” de forma predeterminada.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
typescript
Área
testing
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.