`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 天 1 小时
- 30 天内合并 PR
- 223
环境准备
- 没有 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/build
难度 3/5 1-2 天 新手友好度 55/100
angular/angular-cli#34524 · 2 个 reaction ·
维护者通常 1 天内回复
-
@angular/build@21 depends on [email protected] which is vulnerable to multiple CVEs可能已有人在做 @florimond-collette 于 2 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 30/100
angular/angular-cli#34518 · 1 条评论 ·
维护者通常 1 天内回复
-
area: @angular/build
难度 4/5 3-5 天 新手友好度 55/100
angular/angular-cli#34514 · 2 个 reaction ·
维护者通常 1 天内回复
查看 angular/angular-cli 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 77/100
Clouditera/VulnHunter#57 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
bug bug:behavior clawsweeper:bulk-filed clawsweeper:fix-shape-clear clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:auth-provider issue-rating: 🦞 diamond lobster P2
难度 2/5 1-3 小时 新手友好度 76/100
openclaw/openclaw#185297 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 62/100
-
bug needs-triage
难度 2/5 1-3 小时 新手友好度 76/100
apex-dev-tools/apex-log-parser#199 ·
维护者通常 1 天内回复