Skip to content

Conversation

@christopherthielen
Copy link
Member

@christopherthielen christopherthielen commented Jan 7, 2026

  • Added vitest.config.ts with workspace projects for zone and zoneless tests
  • Added tsconfig.spec.json with isolatedModules: true for Vitest compatibility
  • Updated package.json scripts to use vitest commands

Zone tests (test/setup.ts):

  • Uses @analogjs/vitest-angular/setup-zone for Zone.js integration
  • Includes browser mocks for jsdom environment

Zoneless tests (test-zoneless/setup.ts):

  • Manual TestBed initialization without Zone.js
  • Supports Angular's provideZonelessChangeDetection()

Test changes

  • Replaced jest.spyOn() → vi.spyOn()
  • Replaced jest.fn() → vi.fn()
  • Converted waitForAsync(inject(...)) to async/await patterns
  • Removed deprecated done() callbacks
  • Refactored tests causing ExpressionChangedAfterItHasBeenCheckedError
    in Angular 21's stricter dev mode

Removed:
- jest
- jest-environment-jsdom
- jest-preset-angular
- @types/jest

Added:
- vitest ^4.0.8
- @analogjs/vite-plugin-angular ^2.2.0
- @analogjs/vitest-angular ^2.2.0

- Added vitest.config.ts with workspace projects for zone and zoneless tests
- Added tsconfig.spec.json with isolatedModules: true for Vitest compatibility
- Updated package.json scripts to use vitest commands

Zone tests (test/setup.ts):
- Uses @analogjs/vitest-angular/setup-zone for Zone.js integration
- Includes browser mocks for jsdom environment

Zoneless tests (test-zoneless/setup.ts):
- Manual TestBed initialization without Zone.js
- Supports Angular's provideZonelessChangeDetection()

- Replaced jest.spyOn() → vi.spyOn()
- Replaced jest.fn() → vi.fn()
- Converted waitForAsync(inject(...)) to async/await patterns
- Removed deprecated done() callbacks
- Refactored tests causing ExpressionChangedAfterItHasBeenCheckedError
  in Angular 21's stricter dev mode
@christopherthielen christopherthielen merged commit 6265281 into master Jan 7, 2026
4 checks passed
@christopherthielen christopherthielen deleted the vitest branch January 7, 2026 19:40
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.

2 participants