angular / angular/angular-cli

Schematics testing infrastructure: ability to easily bootstrap a Tree

Aberta
#12,706 2 comentários 1 reação 0 responsáveis Ver no GitHub
area: @angular-devkit/schematics feature feature: insufficient votes
Linguagem predominante
TypeScript
Estrelas
27k
Forks
11.8k
Merge médio
14h 23min
PRs com merge (30d)
162

Descrição

### 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?

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Comece lendo a configuração existente de Schematic exclusiva para testes, incluindo seu código de Schematic, schema, regras de build e a construção de SchematicRunner do teste. Compare os diferentes boilerplates de Tree usados por Rules individuais e defina um pequeno ponto de entrada de testes que possa criar os arquivos e o conteúdo solicitados; estará concluído quando Rules puderem ser testadas unitariamente sem um Schematic dedicado.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
typescript
Domínio
testing, tooling
Tipo de issue
Funcionalidade
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.