1.2 KiB
1.2 KiB
ADR 0008: Testing — Karma + Jasmine
Date: 2026-04-26 Status: Accepted
Context
Angular's default test setup uses Karma as the test runner (executing tests in a real Chrome browser) and Jasmine as the assertion/spec framework. Alternatives include Jest (runs in Node via jsdom, no real browser) and Vitest (ESM-native, faster).
Migrating to Jest or Vitest would require changing test utilities, removing zone.js/testing, and potentially adjusting Angular testing module setup.
Decision
Keep Karma + Jasmine. The test suite (54 specs) is small enough that Karma's startup overhead is not a bottleneck. The default Angular TestBed utilities work without modification.
Consequences
- Positive: Zero migration effort. Full compatibility with Angular's
TestBedandComponentFixtureAPIs. - Positive: Tests run in a real browser, catching browser-specific issues that jsdom misses.
- Negative: Slower startup than Jest/Vitest due to Chrome launch. Acceptable at the current test suite size.
- Future consideration: If the test suite grows significantly or CI performance becomes a concern, evaluate migration to Jest with
jest-preset-angular.