NG.VIII · Angular 22 practice question
During a code review of an Angular 22 test suite, a developer notices this TestBed setup. Is provideZonelessChangeDetection() required here to run the test with zoneless change detection?
TestBed.configureTestingModule({
providers: [provideZonelessChangeDetection()],
});
Check answer and explanation
Correct answer: No, because including provideZonelessChangeDetection() in TestBed is optional
Explanation
Including provideZonelessChangeDetection() in TestBed is optional because TestBed already uses zoneless change detection by default.
Common trap
Teams familiar with earlier Angular versions where zoneless had to be opted in often assume the provider is still mandatory, but Angular 22 TestBed is zoneless by default. Developers sometimes worry that fixture.whenStable() requires an explicit zoneless provider, yet TestBed works with whenStable() in zoneless mode without adding it.
Source: Angular docs: Angular without ZoneJS (Zoneless) — Using Zoneless in `TestBed`
Checked against the cited text on 2026-11-25.