alternatives to change TestBed configurations without creating the test.ts files
- Lenguaje dominante
- TypeScript
- Estrellas
- 27k
- Forks
- 11.8k
- Merge medio
- 14 h 23 min
- PR fusionados (30 d)
- 162
Descripción
### Which @angular/* package(s) are relevant/related to the feature request?
core
### Description
with Angular 15, now the `test.ts` file doesn't get generated by default, so it's not an easy task to change the `TestBed` configurations for example to enable `errorOnUnknownElements`
it will also be nice if we can change the pattern of the tests
### Proposed solution
to add the configurations inside the `angular.json` files in the options section of test
something like
```
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": [],
"errorOnUnknownElements": true, <---
"errorOnUnknownProperties": true, <---
"pattern": "\.custom-spec\.ts$" <---
}
```
### Alternatives considered
to be able to enable them globally from any script (to create a js file and add it to the scripts of the test) with something like
```
getTestBed().setoptions({
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
pattern: /\.custom-spec\.ts$/
});
```
Guía de contribución
Línea de trabajo
Empieza rastreando cómo se gestionan las opciones de test de angular.json y cómo se genera o reemplaza el arranque de test.ts. Usa la configuración solicitada de TestBed y el patrón de tests personalizado como casos de aceptación; se considera terminado cuando los proyectos pueden configurarlos sin crear archivos test.ts.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- angular, typescript
- Área
- testing, tooling
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100