Skip to content

chore: Angular 21->22 + Karma to Vitest test-runner migration - #583

Open
sawankshrma wants to merge 12 commits into
devsecopsmaturitymodel:gsoc2026from
sawankshrma:angular_21-22_karma_to_vitest_migration
Open

chore: Angular 21->22 + Karma to Vitest test-runner migration#583
sawankshrma wants to merge 12 commits into
devsecopsmaturitymodel:gsoc2026from
sawankshrma:angular_21-22_karma_to_vitest_migration

Conversation

@sawankshrma

Copy link
Copy Markdown
Collaborator

description in doc

Ran `ng update @angular/core@22 @angular/cli@22`.
Auto-applied migrations:
- Core packages 21.x → 22.1.0, TypeScript 5.9 → 6.0
- Karma → Vitest test runner (angular.json, tsconfig.spec.json)
- ChangeDetectionStrategy.Eager on all components (default is now OnPush)
- withXhr() added to provideHttpClient calls
- $safeNavigationMigration() wrappers for ?. semantic change
- Suppress nullishCoalescingNotNullable/optionalChainNotNullable diagnostics
- @angular-devkit/build-angular → @angular/build (application builder)
- Replace .eslintrc.json with eslint.config.js
- Add angular-eslint and typescript-eslint packages
- Remove unnecessary eslint-disable comments
Finish what ng update's auto-migration left incomplete:
- Migrate Jasmine APIs → Vitest: spyOn → vi.spyOn,
  toHaveSize → toHaveLength, toBeTrue → toBe(true),
  jasmine.createSpyObj → vi.fn() mock objects
- Remove setupFiles ref to legacy src/test.ts (double init crash)
- Remove deprecated withXhr() from main.ts and all specs
- Remove dead devDeps: @types/jasmine, jasmine-core,
  karma, karma-*, istanbul-lib-instrument
- Add jsdom for Vitest DOM environment
- Restore pnpm-workspace.yaml with allowBuilds configuration

- Remove uuid override from package.json

- Regenerate package-lock.json following Angular 22 upgrade
- Bump CI Node.js from 20.19.6 to 24.19.0
- Drop --browsers=ChromeHeadless from CI test command (no longer
  needed now that tests run under Vitest instead of Karma)
- Pin @typescript-eslint/utils and vitest to exact versions
  (8.65.0, 4.0.8) instead of caret ranges
TS2304: Cannot find name 'Disposable' — @vitest/spy's type
declarations use the Disposable global (TS 5.2 explicit resource
management), which isn't included in ES2022's default lib set.
@sawankshrma

Copy link
Copy Markdown
Collaborator Author

NOTE FOR REVIEWERS:

@sawankshrma sawankshrma changed the title Angular 21 22 karma to vitest migration chore: Angular 21->22 + Karma to Vitest test-runner migration Aug 3, 2026
@sawankshrma
sawankshrma requested a review from vbakke August 3, 2026 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant