Angular 21 new unit test builder with Karma and zone.js
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- angular, typescript
- 領域
- build-system, testing
調査の方向性
packages/angular/build/src/builders/unit-test/runners/karma/executor.ts から始め、angular.json にある Angular 20 と 21 の unit-test builder の設定を比較します。報告書にリンクされているテスト移行のドキュメントを読み、Karma がグローバルなテストセットアップをどのように処理するかを追跡します。期待される Karma 設定が確立され、ドキュメントまたは移行動作によって報告されたアップグレードパスが扱われていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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
20
Description
After upgrading from Angular 20 to 21, I ran into NGXXXX errors when running unit tests still with Karma and zone.js.
I found a closed issue and a supposed fix for it, but that did not resolve the issue.
Others experienced the same and implemented workarounds which actually do work: StackOverflow, Reddit.
I found that the solution could be that the angular.json has to be modified to be in line with the new project template like this:
- change
"builder": "@angular/build:karma" to"builder": "@angular/build:unit-test" - add
"runner": "karma" - remove the rest of the properties (according to documentation these derive from the development configuration)
I did not find anything regarding the necessity of this change in the documentation, but if that is the case, it would be wise to mention it and maybe even add a migration schematic.
Also its not clear what is the alternative for "main": "src/test.ts" which contains global test setup. My guess is that the "setupFiles" property would be the successor (like "karmaConfig" became "runnerConfig"), but that is disabled for Karma.
So my question is: Where should I put global test setup with the new "unit-test" builder when using Karma?
Thanks in advance.
Minimal Reproduction
npm test
Exception or Error
Your Environment
Angular CLI : 21.2.5
Node.js : 24.14.0
Package Manager : npm 11.9.0
Operating System : win32 x64
Anything else relevant?
No response
- 主要言語
- TypeScript
- スター
- 27k
- フォーク
- 11.8k
- 平均マージ
- 16時間 21分
- マージ済み PR(30日)
- 170
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
angular/angular-cli のほかの issue
-
area: @angular/build gemini-triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
angular/angular-cli#33955 ·
-
area: @angular/cli gemini-triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
angular/angular-cli#33055 · コメント 1 件 · リアクション 3 件 ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34131 · 担当者 1 名 ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34130 · 担当者 1 名 ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34128 · 担当者 1 名 ·
angular/angular-cli の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Automattic/studio#4908 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
-
help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
hemilabs/ui-monorepo#2332 ·