angular / angular/angular-cli

Easier way to provide disableConsoleIntercept to ng test with vitest

Ouverte
#32,726 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
area: @angular/cli gemini-triaged
Langage dominant
TypeScript
Étoiles
27k
Forks
11.8k
Merge moyen
14 h 23 min
PR mergées (30 j)
162

Description

### Command

test

### Description

Vitest by default captures the console output, which reduces the ways available to debug tests.

However, there is no direct equivalent option on `ng test` to enable logging and no direct way to pass the `--disableConsoleIntercept` flag to the underlying vitest command.

Attempting to run `ng test --disableConsoleIntercept`
```
Error: Unknown argument: disableConsoleIntercept
```

Attempting to run `ng test -- --disableConsoleIntercept` results in

```
Option '--' has been specified multiple times. The value '--disableConsoleIntercept' will be used.
Error: Schema validation failed with the following errors:
Data path "" must NOT have additional properties().
 ELIFECYCLE  Test failed. See above for more details.
```

Instead it seems like you would have to create a custom vitest configuration, with several other properties, and then provide that in angular.json which is rather heavy handed for simple one-time debugging.

### Describe the solution you'd like

Simple forwarding of arguments `ng test -- --disableConsoleIntercept` which would pass the arguments to the underlying vitest command.

### Describe alternatives you've considered

* Support for this flag on the ng test command directly (though this is not a generic argument for all test types)
* Support for some "forwardedArgs" flag on ng test that allows for flags to be forwarded

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par l’analyse des arguments de la commande ng test et de son intégration avec Vitest, puis reproduisez les erreurs de ligne de commande signalées. C’est terminé lorsque les arguments placés après -- parviennent à Vitest sans erreurs de validation de schéma, y compris --disableConsoleIntercept, avec une couverture dans les tests de commande concernés.

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

Évaluation

Stack technique
angular, typescript
Domaine
cli, testing
Type d'issue
Fonctionnalité
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
55/100

Recevez les nouvelles issues par e-mail

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