fake_async icon indicating copy to clipboard operation
fake_async copied to clipboard

Add option to automatically progress microtasks.

Open lrhn opened this issue 1 year ago • 1 comments

If autoMicrotasks is set to true when creating FakeAsync or calling fakeAsync, the microtask queue will automatically be flushed by a microtask from the parent zone.

For tests that only care about larger-grained timers, this can make it easier to ensure progress for intermediate computations.

Also binds timer and microtask callbacks in their originating zone, to ensure they are run there, and that unhandled errors get reported in that zone.

lrhn avatar Feb 03 '24 15:02 lrhn

(I looked at the issues, and a lot of them seem to come back to someone not progressing microtasks enough. Could this approach be a way to ensure some progress for tests that only really care about the big timer-steps? Maybe it'll just move the same issues further up the event stack.)

lrhn avatar Feb 03 '24 15:02 lrhn