NG.X · Angular 22 practice question

Before running Vitest unit tests in a real browser for an Angular project, what setup step is required first?

Choose one answer
Check answer and explanation

Correct answer: Install a browser provider.

Explanation

To execute Vitest tests in a real browser, you must first install a browser provider for Vitest's browser mode.

Common trap

This is tempting because Node.js environments use DOM shims, but running in a real browser eliminates the need for a custom DOM shim rather than requiring one. This is tempting because browser mode switches away from the Node.js test environment, but you do not disable Node.js in package.json.

Source: Angular docs: Unit testing — Running tests in a browser
Checked against the cited text on 2026-11-25.

Report an error in this question