`ng generate web-worker` adds `webWorkerTsConfig` to the `@angular/build:unit-test` target, breaking `ng test`
Les mainteneurs répondent en général sous 1 jour
Une pull request liée a déjà été fusionnée.
- #34386 par @MeAkib — fusionnée
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 35/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- À l'abandon
- Stack technique
- angular, typescript
- Domaine
- testing
Piste de recherche
Read packages/schematics/angular/web-worker/index.ts and inspect the logic that adds webWorkerTsConfig to the test target. Compare the supported test builders with the unit-test builder’s options, then check the schematic spec mentioned in the issue’s proposed fix. Done means generating a web worker leaves ng test --watch=false passing for a new application.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Command
generate
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
Running ng generate web-worker in a newly created application breaks ng test.
The web-worker schematic adds webWorkerTsConfig to the options of the project's test target, regardless of
which builder that target uses. New applications use the @angular/build:unit-test builder, whose schema does not
have a webWorkerTsConfig option, so ng test fails schema validation afterwards.
The option is still needed on the build target (where the schematic also adds it). Removing it from the test
target makes ng test pass again, including with the worker in place.
Relevant code: packages/schematics/angular/web-worker/index.ts
if (testTarget) {
(testTarget.options ??= {}).webWorkerTsConfig ??= workerConfigPath;
}
Minimal Reproduction
ng new ww-repro --defaultscd ww-reprong test --watch=false→ passesng generate web-worker appng test --watch=false→ fails with the error below
After step 4, the test target in angular.json is:
"test": {
"builder": "@angular/build:unit-test",
"options": {
"webWorkerTsConfig": "tsconfig.worker.json"
}
}
Deleting webWorkerTsConfig from the test target options makes ng test pass again.
Exception or Error
Error: Schema validation failed with the following errors:
Unknown option "webWorkerTsConfig". Valid options are: buildTarget, tsConfig, runner, runnerConfig, browsers, browserViewport, include, exclude, filter, watch, headless, debug, ui, isolate, splitting, quiet, coverage, coverageInclude, coverageExclude, coverageReporters, coverageThresholds, coverageWatermarks, reporters, outputFile, providersFile, setupFiles, progress, listTests, dumpVirtualFiles.
Your Environment
Angular CLI : 22.2.3
Node.js : 24.15.0
Package Manager : npm 11.12.1
OS : darwin arm64
@angular/build : 22.2.3
vitest : 5.0.5
Anything else relevant?
Suggested fix: only add webWorkerTsConfig to the test target when it uses a Karma builder
(@angular-devkit/build-angular:karma / @angular/build:karma). The unit-test builder gets build options from
its buildTarget. Happy to send a PR with a spec.
- Langage dominant
- TypeScript
- Étoiles
- 27k
- Forks
- 11.8k
- Merge moyen
- 1 j 6 h
- PR mergées (30 j)
- 224
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire 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-serverOuvertearea: @angular/build gemini-triaged
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
angular/angular-cli#33955 ·
Les mainteneurs répondent en général sous 1 jour
-
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 ·
Les mainteneurs répondent en général sous 1 jour
-
area: @angular/ssr
Difficulté 4/5 3-5 jours Accessibilité débutants 53/100
angular/angular-cli#34474 ·
Les mainteneurs répondent en général sous 1 jour
-
`ng generate app-shell` and `ng generate module --route` produce broken imports when a component `type` is configuredPeut-être pris @MeAkib l’a pris il y a 1 jour. Ouvertearea: @schematics/angular
Difficulté 3/5 1-2 jours Accessibilité débutants 35/100
angular/angular-cli#34449 ·
Les mainteneurs répondent en général sous 1 jour
-
Tailwind CSS v4 classes in new or moved files are not picked up by ng serve until another rebuildPeut-être pris @MeAkib l’a pris il y a 1 jour. Ouvertearea: @angular/build
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
angular/angular-cli#34446 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de angular/angular-cli
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
phivk/rubiks-lab#33 ·
Les mainteneurs répondent en général sous 1 jour
-
BUG:Edit Album strips spaces from the password so albums with a leading/trailing space in the password can't be editedPeut-être pris @ManyaJain111 l’a pris aujourd’hui. Ouvertebug enhancement possible-duplicate
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
AOSSIE-Org/PictoPy#1637 · 4 commentaires ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
chaitin/MonkeyCode#1437 ·
Les mainteneurs répondent en général sous 1 jour
-
rtdb-info-connected-order test: unhandled 'connection is closed' rejection fails the CLI suiteOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
area:cards enhancement migration ready-for-agent
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
fil-donadoni/tolaria#6309 ·
Les mainteneurs répondent en général sous 1 jour