Внести вклад
    • Обзор
@angular/core/testing

flush

function
stable

ВАЖНО: This API requires Zone.js and cannot be used with the Vitest test runner

API

function flush(maxTurns?: number | undefined): number;
@parammaxTurnsnumber | undefined

The maximum number of times the scheduler attempts to clear its queue before throwing an error.

@returnsnumber

The simulated time elapsed, in milliseconds.

Description

ВАЖНО: This API requires Zone.js and cannot be used with the Vitest test runner

Flushes any pending microtasks and simulates the asynchronous passage of time for the timers in the fakeAsync zone by draining the macrotask queue until it is empty.

Перейти к деталям