angular / angular/angular-cli

Schematics testing infrastructure: ability to easily bootstrap a Tree

Ouverte
#12,706 2 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
area: @angular-devkit/schematics feature feature: insufficient votes
Langage dominant
TypeScript
Étoiles
27k
Forks
11.8k
Merge moyen
14 h 23 min
PR mergées (30 j)
162

Description

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

### Desired functionality

I'd like to be able to more easily unit test individual Rules. and to do this, I'd like to be able to easily create a Tree on the fly.

My current strategy is to create a new schematic for the sole purpose of testing. But there is quite a bit of boilerplate that goes into this: the schematic code, the schema, the build rules, the awkward dependency of the test on this schematic, and the construction of a new schematicRunner in the test. Furthermore, different Rules need different Tree "boilerplate" for testing, so instead of creating a new schematic for each, I've just been jamming all the different types of files I need into this one test-only schematic, which is becoming unwieldy - which files are for testing which Rules?

Sometimes, I am testing a really simple Rule that only operates on one file, and I just want to be able to ask some function: "give me a tree with one file at this certain path with this certain content" or "give me a tree with an empty file at this path" and so on.

I think it'd be great if there was some testing infrastructure that could cook up a quick Tree in place. Or - does something like this already exist?

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par lire la configuration existante de Schematic réservée aux tests, notamment son code de Schematic, son schéma, ses règles de build et la construction de SchematicRunner du test. Comparez les différents boilerplates de Tree utilisés par les Rules individuelles et définissez un petit point d’entrée de test capable de créer les fichiers et le contenu demandés ; le travail sera terminé lorsque les Rules pourront être testées unitairement sans Schematic dédié.

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

Évaluation

Stack technique
typescript
Domaine
testing, tooling
Type d'issue
Fonctionnalité
Difficulté
4/5
Temps estimé
3-5 jours
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.