@angular/build:karma ignores overrides in karma.conf.js
- Langage dominant
- TypeScript
- Étoiles
- 27k
- Forks
- 11.8k
- Merge moyen
- 14 h 23 min
- PR mergées (30 j)
- 162
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
Using the new `@angular/build:karma` builder, coverage overrides defined in the `karma.conf.js` are ignored.
### Minimal Reproduction
* clone https://github.com/fynnfeldpausch/karma-coverage
* take a look at `app.ts` - there is an additional method
* take a look at `karma.conf.js` and the defined coverage
* global coverage is set to 80%
* local coverage is set to 0% for `app.ts`
* run `ng test -- --no-watch --no-progress --browsers=ChromeHeadless --code-coverage`
### Exception or Error
```text
Test run fails with coverage errors:
19 08 2025 15:57:46.079:ERROR [coverage]: Chrome Headless 139.0.0.0 (Mac OS 10.15.7): Coverage for statements (75%) does not meet per-file (/repro-app/src/app/app.ts) threshold (80%)
19 08 2025 15:57:46.079:ERROR [coverage]: Chrome Headless 139.0.0.0 (Mac OS 10.15.7): Coverage for lines (66.66%) does not meet per-file (/repro-app/src/app/app.ts) threshold (80%)
19 08 2025 15:57:46.079:ERROR [coverage]: Chrome Headless 139.0.0.0 (Mac OS 10.15.7): Coverage for functions (0%) does not meet per-file (/repro-app/src/app/app.ts) threshold (80%)
```
### Your Environment
```text
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 20.1.6
Node: 24.2.0
Package Manager: npm 11.3.0
OS: darwin arm64
Angular: 20.1.7
... common, compiler, compiler-cli, core, forms
... platform-browser, router
Package Version
------------------------------------------------------
@angular-devkit/architect 0.2001.6
@angular-devkit/core 20.1.6
@angular-devkit/schematics 20.1.6
@angular/build 20.1.6
@angular/cli 20.1.6
@schematics/angular 20.1.6
rxjs 7.8.2
typescript 5.8.3
zone.js 0.15.1
```
### Anything else relevant?
_No response_
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Clonez la reproduction liée de karma-coverage et inspectez app.ts et karma.conf.js, puis exécutez la commande ng test indiquée pour reproduire l’échec de couverture. Suivez la manière dont @angular/build:karma gère la configuration et vérifiez que la surcharge de couverture par fichier est respectée, tandis que le seuil global reste effectif.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- angular, typescript
- Domaine
- build-system, testing
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100