flush
IMPORTANT: This API requires Zone.js and cannot be used with the Vitest test runner
API
function flush(maxTurns?: number | undefined): number;
@parammaxTurns
number | undefinedThe maximum number of times the scheduler attempts to clear its queue before throwing an error.
@returns
numberThe simulated time elapsed, in milliseconds.
Description
IMPORTANT: 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.
Super-powered by Google ©2010–2025.
Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0.
https://angular.dev/api/core/testing/flush