angular / angular/angular-cli

SchematicTestRunner.callRule does not use the logger by default

Ouverte
#12,087 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
area: @angular-devkit/schematics effort1: easy (hours) type: bug/fix
Langage dominant
TypeScript
Étoiles
27k
Forks
11.8k
Merge moyen
14 h 23 min
PR mergées (30 j)
162

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par SchematicTestRunner.callRule et suivez la manière dont son logger est fourni au contexte de la règle. Examinez les tests unitaires des règles et reproduisez l’exemple présenté, puis vérifiez que le logger du runner reçoit “Hello world!” par défaut.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
typescript
Domaine
testing
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.