`unit-test` builder with `vitest` is slow for testing and for code coverage

オープン
#31,724 コメント 17 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
angular, typescript

調査の方向性

まず、unit-test builder と Vitest を使用する小規模な Angular CLI プロジェクトで、ng test --no-watch コマンドと coverage コマンドを使って報告された時間を再現し、その後 Karma と比較します。移行に関係する unit-test builder と jasmine-to-vitest schematic のエントリーポイントを読みます。低速化の原因を特定し、テストと coverage の実行時間が改善されたことを示せれば完了です。

索引モデルが issue の本文から書いたものです。

説明

angular/build:unit-test area: @angular/build freq1: low needs: investigation severity4: memory/performance
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

I migrated a very small existing project using the jasmine-to-vitest schematic and code coverage is fairly slow when using vitest (roughly 80 tests).

With the karma builder:

ng test --no-watch                               9,99s user 1,71s system 214% cpu 5,459 total
ng test --no-watch --code-coverage  17,82s user 2,42s system 232% cpu 8,719 total

When migrates to the unit-test builder (and a few tests disabled):

ng test --no-watch                     18,49s user 3,33s system 259% cpu 8,396 total
ng test --no-watch --coverage  38,46s user 4,66s system 210% cpu 20,535 total

The tests themselves takes 18s (10s with Karma), and the code coverage takes 20s instead of 8s. This is very noticeable when using vitest.

Minimal Reproduction

This is probably reproducible in a new CLI project, by generating a bunch of components and comparing test times.

Exception or Error

Your Environment
Angular CLI       : 21.0.0-rc.1
Angular           : 21.0.0-rc.1
Node.js           : 22.18.0
Package Manager   : npm 10.9.0
Operating System  : darwin arm64

┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package                   │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build            │ 21.0.0-rc.1       │ 21.0.0-rc.1       │
│ @angular/cli              │ 21.0.0-rc.1       │ 21.0.0-rc.1       │
│ @angular/common           │ 21.0.0-rc.1       │ 21.0.0-rc.1       │
│ @angular/compiler         │ 21.0.0-rc.1       │ 21.0.0-rc.1       │
│ @angular/compiler-cli     │ 21.0.0-rc.1       │ 21.0.0-rc.1       │
│ @angular/core             │ 21.0.0-rc.1       │ 21.0.0-rc.1       │
│ @angular/forms            │ 21.0.0-rc.1       │ 21.0.0-rc.1       │
│ @angular/localize         │ 21.0.0-rc.1       │ 21.0.0-rc.1       │
│ @angular/platform-browser │ 21.0.0-rc.1       │ 21.0.0-rc.1       │
│ @angular/router           │ 21.0.0-rc.1       │ 21.0.0-rc.1       │
│ rxjs                      │ 7.8.2             │ 7.8.2             │
│ typescript                │ 5.9.3             │ 5.9.3             │
│ vitest                    │ 4.0.8             │ 4.0.8             │
Anything else relevant?

Of course this is maybe an upstream problem, but I thought it was worth mentioning it.

主要言語
TypeScript
スター
27k
フォーク
11.8k
平均マージ
16時間 35分
マージ済み PR(30日)
176

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

angular/angular-cli のほかの issue

angular/angular-cli の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。