alternatives to change TestBed configurations without creating the test.ts files
- Langage dominant
- TypeScript
- Étoiles
- 27k
- Forks
- 11.8k
- Merge moyen
- 14 h 23 min
- PR mergées (30 j)
- 162
Description
### 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$/
});
```
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par suivre la manière dont les options de test de angular.json sont gérées et dont le bootstrap de test.ts est généré ou remplacé. Utilisez les paramètres TestBed demandés et le motif de test personnalisé comme cas d’acceptation ; le travail est terminé lorsque les projets peuvent les configurer sans créer de fichiers test.ts.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- angular, 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