[Angular] Upgrade to Angular 22.2 + Vitest 5 + jsdom 30.1 once Nx supports 22.2 (blocked on Nx 23.3 / nrwl/nx#37234) #1165

Open
opened 2026-10-02 04:44:19 +00:00 by spikerj · 0 comments
Owner

Why

Angular 22.2.1 / CLI 22.2.0 (Sept 23/30) and Vitest 5.0.3 are out. We're held on Angular 22.1.x because Nx 23.2.1 (latest) still declares angularVersion = '~22.1.0'; 22.2 support is in draft nrwl/nx#37234 (expected Nx 23.3). Vitest 5 needs @angular/build 22.2 (22.1.x peers vitest ^4 only), and the jsdom pin (30.0.1, a4b29f9dc) can only lift with Vitest 5.0.3 — the jsdom 30.1 _buffer Blob/File breakage was a Vitest bug (vitest-dev/vitest#11336, fixed in 5.0.3 by #11379; v4 backport #11384 still open).

Changelogs reviewed: angular CHANGELOG 22.2.0-22.2.1, angular-cli 22.2.0, components 22.2.0-22.2.1, ng-packagr 22.2.x, vitest 5 migration guide. No source-level breaking changes in Angular 22.2.

What changes for us (do these in the upgrade PR)

Angular 22.2 / CLI

  • @angular/build 22.2 no longer writes stats.json — it writes browser-stats.json + browser-initial-stats.json (angular-cli 175273931). Fix scripts/bundle-cjs-vs-total-report.mjs:10; the stats script (package.json ~L16) already points at a wrong path and needs webpack-bundle-analyzer (not installed); build:analyze calls a non-existent analyze:bundles.
  • With the service worker on, preloadInitial now defaults to false → no <link rel="modulepreload"> in index.html (angular-cli d396324b4). Accept (avoids double fetch with ngsw) or set index.preloadInitial: true; decide explicitly in projects/spikersoft/project.json.
  • Unit-test builder now runs setupFiles hooks per spec under coverage — do a full coverage run (projects/spikersoft/vitest.config.ts has two setupFiles + v8 coverage).
  • Use ng-packagr 22.2.4 (reverts 22.2.x parallel entry-point scheduling; ng-packagr switched rollup → rolldown in 22.2.0) and run nx run-many -t build across the ~114 library targets (ng-packagr-lite subclasses ng-packagr internals).
  • Bump @angular/* 22.2.1, CLI/build/schematics 22.2.x, cdk/material/aria/google-maps 22.2.1 — via nx migrate if Nx 23.3 lands, else directly.

Vitest 5 (+ coverage-v8)

  • clearMocks now defaults to true — audit specs that set up mocks in beforeAll/describe scope and assert call counts (13 files use beforeAll); or set clearMocks: false first and remove later.
  • json/junit reporters + attachments move under .vitest/ — add to .gitignore, eslint ignores, sonar.exclusions.
  • Confirm VITEST_MAX_WORKERS is still honoured (CI: main.yml ~L534, sonarqube-scan.yml ~L90/117).
  • Coverage include/exclude matching changed — compare lcov file counts before/after (Sonar job expects ≥60 lcov files).
  • Update the "Standing holds" / graveyard comments in pnpm-workspace.yaml and the "Vitest 4 hoisted…" comment in projects/spikersoft/vitest.config.ts; 22.2 deprecates unit-test splitting (we don't set it, but the comment recommends it).

jsdom

  • Unpin to ^30.1; 121 spec files use Blob/File/createObjectURL — full suite.

Size: M-L.

Links: Unblocks #1166, #1167, #1169, #1174. Pins kept until then: jsdom 30.0.1, vitest 4.


Filed from the 2026-10-02 spikersoft-angular pnpm outdated changelog review.

## Why Angular **22.2.1** / CLI **22.2.0** (Sept 23/30) and **Vitest 5.0.3** are out. We're held on Angular 22.1.x because Nx 23.2.1 (latest) still declares `angularVersion = '~22.1.0'`; 22.2 support is in **draft** nrwl/nx#37234 (expected Nx 23.3). Vitest 5 needs `@angular/build` 22.2 (22.1.x peers vitest `^4` only), and the jsdom pin (30.0.1, a4b29f9dc) can only lift with Vitest 5.0.3 — the jsdom 30.1 `_buffer` Blob/File breakage was a Vitest bug (vitest-dev/vitest#11336, fixed in 5.0.3 by #11379; v4 backport #11384 still open). Changelogs reviewed: angular CHANGELOG 22.2.0-22.2.1, angular-cli 22.2.0, components 22.2.0-22.2.1, ng-packagr 22.2.x, vitest 5 migration guide. No source-level breaking changes in Angular 22.2. ## What changes for us (do these in the upgrade PR) **Angular 22.2 / CLI** - [ ] `@angular/build` 22.2 no longer writes `stats.json` — it writes `browser-stats.json` + `browser-initial-stats.json` (angular-cli 175273931). Fix `scripts/bundle-cjs-vs-total-report.mjs:10`; the `stats` script (`package.json` ~L16) already points at a wrong path and needs `webpack-bundle-analyzer` (not installed); `build:analyze` calls a non-existent `analyze:bundles`. - [ ] With the service worker on, `preloadInitial` now defaults to **false** → no `<link rel="modulepreload">` in `index.html` (angular-cli d396324b4). Accept (avoids double fetch with ngsw) or set `index.preloadInitial: true`; decide explicitly in `projects/spikersoft/project.json`. - [ ] Unit-test builder now runs setupFiles hooks per spec under coverage — do a full coverage run (`projects/spikersoft/vitest.config.ts` has two setupFiles + v8 coverage). - [ ] Use **ng-packagr 22.2.4** (reverts 22.2.x parallel entry-point scheduling; ng-packagr switched rollup → rolldown in 22.2.0) and run `nx run-many -t build` across the ~114 library targets (`ng-packagr-lite` subclasses ng-packagr internals). - [ ] Bump `@angular/*` 22.2.1, CLI/build/schematics 22.2.x, cdk/material/aria/google-maps 22.2.1 — via `nx migrate` if Nx 23.3 lands, else directly. **Vitest 5 (+ coverage-v8)** - [ ] `clearMocks` now defaults to **true** — audit specs that set up mocks in `beforeAll`/describe scope and assert call counts (13 files use `beforeAll`); or set `clearMocks: false` first and remove later. - [ ] json/junit reporters + attachments move under `.vitest/` — add to `.gitignore`, eslint ignores, `sonar.exclusions`. - [ ] Confirm `VITEST_MAX_WORKERS` is still honoured (CI: `main.yml` ~L534, `sonarqube-scan.yml` ~L90/117). - [ ] Coverage include/exclude matching changed — compare lcov file counts before/after (Sonar job expects ≥60 lcov files). - [ ] Update the "Standing holds" / graveyard comments in `pnpm-workspace.yaml` and the "Vitest 4 hoisted…" comment in `projects/spikersoft/vitest.config.ts`; 22.2 deprecates unit-test `splitting` (we don't set it, but the comment recommends it). **jsdom** - [ ] Unpin to `^30.1`; 121 spec files use Blob/File/createObjectURL — full suite. Size: **M-L**. **Links:** Unblocks #1166, #1167, #1169, #1174. Pins kept until then: jsdom 30.0.1, vitest 4. --- _Filed from the 2026-10-02 spikersoft-angular `pnpm outdated` changelog review._
spikerj added the enhancement label 2026-10-02 04:44:19 +00:00
Sign in to join this conversation.