`unit-test` builder with `vitest` is slow for testing and for code coverage
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- angular, typescript
- Ambito
- performance, testing, tooling
Direzione di ricerca
Inizia riproducendo i tempi riportati con i comandi ng test --no-watch e di coverage in un piccolo progetto Angular CLI che utilizzi il builder unit-test e Vitest, quindi confrontali con Karma. Leggi gli entry point del builder unit-test e dello schematic jasmine-to-vitest coinvolti nella migrazione. Il lavoro è completato quando viene identificata la causa del rallentamento e vengono dimostrati tempi migliori per i test e la coverage.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- TypeScript
- Stelle
- 27k
- Fork
- 11.8k
- Merge medio
- 16h 35m
- PR unite (30g)
- 176
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di angular/angular-cli
-
area: @angular/build gemini-triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
angular/angular-cli#33955 ·
-
area: @angular/cli gemini-triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
angular/angular-cli#33055 · 1 commento · 3 reazioni ·
-
unit-test: with --coverage, a setup file's hooks reach only the first spec file of each worker Apertaarea: @angular/build gemini-triaged
Difficoltà 4/5 3-5 giorni Idoneità per principianti 72/100
angular/angular-cli#34137 ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34131 · 1 assegnatario ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34130 · 1 assegnatario ·
Tutte le issue di angular/angular-cli
Issue simili
-
comp/desktop P3 type/bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
NousResearch/hermes-agent#118866 ·
-
Browser Waiting for: Product Owner
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
getsentry/sentry-javascript#24577 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
agilepathway/label-checker#640 ·
-
Plugin stuck at "loading" on DSH 0.1.6-alpha.2 — turnTail list slot registration missing options.id Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Add 2021 Cup data to website Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
chrisparsons83/flexspotff#153 ·