NG.VIII · Angular 22 practice question

A team upgrades an application to Angular 22 while still loading zone.js in polyfills. When the following unit test runs without any change-detection providers, which mode does TestBed use?

it('renders user details', async () => {
  TestBed.configureTestingModule({});
  const fixture = TestBed.createComponent(UserCard);
  await fixture.whenStable();
});
Choose one answer
Check answer and explanation

Correct answer: Zoneless change detection by default

Explanation

TestBed defaults to zoneless change detection in Angular 22 regardless of whether zone.js is included in the application's polyfills.

Common trap

Developers migrating older projects often assume loading zone.js in polyfills automatically enables Zone-based testing, but TestBed still defaults to zoneless mode. Manual-only detection is a common misconception about zoneless tests, whereas TestBed runs zoneless change detection automatically and settles with fixture.whenStable().

Source: Angular docs: Angular without ZoneJS (Zoneless) — Using Zoneless in `TestBed`
Checked against the cited text on 2026-11-25.

Report an error in this question