Coverage in library `unit-test` includes dependent library files and does not reduce runtime when using coverage.include
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 48/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Calme
- Stack technique
- angular, typescript
- Domaine
- build-system, performance, testing-qa
Piste de recherche
Commencez par reproduire le problème avec ng test lib-a --coverage en utilisant deux bibliothèques Angular workspace dépendantes et le builder @angular/build:unit-test. Comparez la sortie de coverage et le temps d’exécution avec et sans coverage.include ; c’est terminé lorsque les fichiers de la bibliothèque dépendante sont exclus et que la restriction de la coverage réduit également le temps d’exécution.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Command
test
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
When running unit tests for a library with @angular/build:unit-test, the coverage report includes files from other workspace libraries that the tested library depends on, which is unexpected.
Although this can be restricted with coverage.include, coverage execution time remains unchanged.
Minimal Reproduction
- Create two Angular libraries in the workspace (e.g.
lib-aandlib-b) - Make
lib-adepend onlib-b - Add a unit test in
lib-a - Run tests with coverage enabled:
ng test lib-a --coverage
Observed behavior
- The coverage report contains files from
lib-b, even though onlylib-ais being tested. - Restricting
coverage.includechanges the generated report but does not noticeably reduce execution time.
Performance
Times below are for a single library test run inside a larger Angular monorepo where the tested library depends on ~7 other libraries from the same workspace.
Execution times vary depending on configuration (development vs production) used to build each of the libraries.
Without coverage:
Duration 24.94s
(transform 62.28s, setup 6.91s, import 98.85s, tests 982ms, environment 13.89s)
With coverage (production build):
Duration 154.60s
(transform 78.24s, setup 13.24s, import 135.76s, tests 1.58s, environment 19.90s)
With coverage (development build)
Duration 201.20s
(transform 57.83s, setup 10.09s, import 99.85s, tests 1.25s, environment 15.00s)
Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI : 22.0.4
Angular : 22.0.4
Node.js : 24.16.0
Package Manager : npm 11.13.0
Operating System : linux x64
┌───────────────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────────────┼───────────────────┼───────────────────┤
│ @angular/animations │ 22.0.4 │ ^22.0.4 │
│ @angular/build │ 22.0.4 │ ^22.0.4 │
│ @angular/cli │ 22.0.4 │ ^22.0.4 │
│ @angular/common │ 22.0.4 │ ^22.0.4 │
│ @angular/compiler │ 22.0.4 │ ^22.0.4 │
│ @angular/compiler-cli │ 22.0.4 │ ^22.0.4 │
│ @angular/core │ 22.0.4 │ ^22.0.4 │
│ @angular/forms │ 22.0.4 │ ^22.0.4 │
│ @angular/localize │ 22.0.4 │ ^22.0.4 │
│ @angular/platform-browser │ 22.0.4 │ ^22.0.4 │
│ @angular/platform-browser-dynamic │ 22.0.4 │ ^22.0.4 │
│ @angular/router │ 22.0.4 │ ^22.0.4 │
│ @angular/service-worker │ 22.0.4 │ ^22.0.4 │
│ ng-packagr │ 22.0.0 │ ^22.0.0 │
│ rxjs │ 7.8.2 │ ~7.8.2 │
│ typescript │ 6.0.3 │ ^6.0.3 │
│ vitest │ 4.1.9 │ ^4.1.9 │
│ zone.js │ 0.16.2 │ ~0.16.2 │
└───────────────────────────────────┴───────────────────┴───────────────────┘
Anything else relevant?
No response
- Langage dominant
- TypeScript
- Étoiles
- 27k
- Forks
- 11.8k
- Merge moyen
- 16 h 35 min
- PR mergées (30 j)
- 176
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de angular/angular-cli
-
Can't use an array of hostnames in --allowedHosts cli parameter in @angular/build:dev-server Ouvertearea: @angular/build gemini-triaged
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
angular/angular-cli#33955 ·
-
area: @angular/cli gemini-triaged
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
angular/angular-cli#33055 · 1 commentaire · 3 réactions ·
-
unit-test: with --coverage, a setup file's hooks reach only the first spec file of each worker Ouvertearea: @angular/build gemini-triaged
Difficulté 4/5 3-5 jours Accessibilité débutants 72/100
angular/angular-cli#34137 ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34131 · 1 personne assignée ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34130 · 1 personne assignée ·
Toutes les issues de angular/angular-cli
Issues similaires
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
linagora/twake-calendar-frontend#1377 · 1 commentaire ·
-
Claiming namespace Londopy Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 72/100
EclipseFdn/open-vsx.org#13385 · 1 commentaire ·
-
front-end UI/UX
Difficulté 1/5 Moins d'une heure Accessibilité débutants 75/100
-
[Icon Request]: Frankenphp Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
-
S: triage
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100