fakeAsync
function
stable
Wraps a function to be executed in the fakeAsync zone:
- Microtasks are manually executed by calling
flushMicrotasks(). - Timers are synchronous;
tick()simulates the asynchronous passage of time.
fakeAsync
(...args: any[]) => anyWraps a function to be executed in the fakeAsync zone:
- Microtasks are manually executed by calling
flushMicrotasks(). - Timers are synchronous;
tick()simulates the asynchronous passage of time.
Can be used to wrap inject() calls.
@paramoptions
{ flush?: boolean | undefined; } | undefined- flush: When true, will drain the macrotask queue after the test function completes. When false, will throw an exception at the end of the function if there are pending timers.
@returns
(...args: any[]) => anyDescription
Wraps a function to be executed in the fakeAsync zone:
- Microtasks are manually executed by calling
flushMicrotasks(). - Timers are synchronous;
tick()simulates the asynchronous passage of time.
Can be used to wrap inject() calls.
Jump to details