Skip to main content

Function: createTestEngine()

createTestEngine<T>(component, partDefinitions, option?): Promise<TestEngine<T>>

Defined in: angular-core/src/createTestEngine.ts:41

Create a test engine for a standalone Angular component (Angular 20+).

The component is mounted through Angular's real bootstrap API (createApplication + ApplicationRef.bootstrap) rather than TestBed, mirroring how the React adapters use createRoot rather than a testing harness. Bootstrapping is asynchronous in Angular, so unlike the React/Vue adapters this function returns a Promise — await it in your setup hook.

Change detection mode follows the environment: when zone.js is loaded the app bootstraps zone-based — explicitly via provideZoneChangeDetection(), because Angular 21+ defaults to zoneless even with zone.js present — and when it is not, provideZonelessChangeDetection() is added automatically. Pass explicit providers via option.providers to override (e.g. force zoneless with zone.js present).

Type Parameters​

T​

T extends ScenePart

Parameters​

component​

Type<unknown>

The standalone component class to bootstrap

partDefinitions​

T

The scene part definitions

option?​

Readonly<Partial<IAngularTestEngineOption>>

Returns​

Promise<TestEngine<T>>

Promise of the test engine