`ng generate web-worker` adds `webWorkerTsConfig` to the `@angular/build:unit-test` target, breaking `ng test`
維護者通常 1 天內回覆
已經有一個關聯 PR 被合併了。
- #34386 來自 @MeAkib —— 已合併
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 停滯
- 技術堆疊
- angular, typescript
- 領域
- testing
研究方向
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.
由索引模型根據 Issue 內容生成。
描述
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.
- 主要語言
- TypeScript
- 星號
- 27k
- 分支
- 11.8k
- 平均合併
- 1 天 6 小時
- 30 天內合併 PR
- 224
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
angular/angular-cli 的其他 Issue
-
area: @angular/build gemini-triaged
難度 2/5 1-3 小時 新手友好度 74/100
angular/angular-cli#33955 ·
維護者通常 1 天內回覆
-
area: @angular/cli gemini-triaged
難度 2/5 1-3 小時 新手友好度 72/100
angular/angular-cli#33055 · 1 則留言 · 3 個 reaction ·
維護者通常 1 天內回覆
-
area: @angular/ssr
難度 4/5 3-5 天 新手友好度 53/100
angular/angular-cli#34474 ·
維護者通常 1 天內回覆
-
`ng generate app-shell` and `ng generate module --route` produce broken imports when a component `type` is configured可能已有人在做 @MeAkib 於 1 天前認領。 未關閉area: @schematics/angular
難度 3/5 1-2 天 新手友好度 35/100
angular/angular-cli#34449 ·
維護者通常 1 天內回覆
-
Tailwind CSS v4 classes in new or moved files are not picked up by ng serve until another rebuild可能已有人在做 @MeAkib 於 1 天前認領。 未關閉area: @angular/build
難度 4/5 3-5 天 新手友好度 35/100
angular/angular-cli#34446 ·
維護者通常 1 天內回覆
查看 angular/angular-cli 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 68/100
chaitin/MonkeyCode#1437 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 69/100
carbon-design-system/carbon-ai-chat#2615 ·
維護者通常 1 天內回覆
-
e2e-failure ready-to-code
難度 2/5 1-3 小時 新手友好度 76/100
redhat-developer/rhdh-plugin-export-overlays#4486 · 1 則留言 ·
維護者通常 1 天內回覆
-
[Bug]: fileUploadMatrix.test.ts URL case does a real DNS lookup and fails offline可能已有人在做 @r2jaff 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
ComposioHQ/composio#5054 ·
維護者通常 1 天內回覆