angular/packages/zone.js/lib/zone-spec
Andrew Scott 70e8b40750 fix(zone.js): Update the default behavior of fakeAsync to flush after the test (#57240)
From the internal issue on the matter:

> When using the standard Jasmine version of it promises returned by the body function are automatically awaited. The Catalyst version of it is fake-async, so awaiting the promise does not make sense; however it would be nice if Catalyst automatically flushed the promise to replicate the experience of using standard it. This would allow users to do the following:

```
it('should fail later', async () => {
  await new Promise(r => setTimeout(r));
  fail('failure');
});
```
> In Catalyst today the above test will pass. If this proposal to automatically flush the resulting promise were implemented it would fail.

Flushing after the tests complete has been the default behavior inside
Google since 2020. Very few tests remain that use the old behavior of
only flushing microtasks. The example above would actually fail with
`fakeAsync` due to the pending timer, but the argument still remains the
same. We might as well just flush if we're going to fail the test
anyways by throwing if there's no flush at the end.

BREAKING CHANGE: `fakeAsync` will now flush pending timers at the end of
the given function by default. To opt-out of this, you can use `{flush:
false}` in options parameter of `fakeAsync`

PR Close #57240
2024-08-05 20:24:54 +00:00
..
async-test.ts refactor: migrate zone.js to prettier formatting (#55427) 2024-04-29 09:52:05 -07:00
fake-async-test.ts fix(zone.js): Update the default behavior of fakeAsync to flush after the test (#57240) 2024-08-05 20:24:54 +00:00
long-stack-trace.ts refactor: migrate zone.js to prettier formatting (#55427) 2024-04-29 09:52:05 -07:00
proxy.ts refactor: migrate zone.js to prettier formatting (#55427) 2024-04-29 09:52:05 -07:00
rollup-long-stack-trace.ts refactor(zone.js): update Zone bundles to call patch* functions (#53443) 2024-03-15 18:11:33 -07:00
rollup-proxy.ts refactor(zone.js): update Zone bundles to call patch* functions (#53443) 2024-03-15 18:11:33 -07:00
rollup-sync-test.ts refactor(zone.js): update Zone bundles to call patch* functions (#53443) 2024-03-15 18:11:33 -07:00
rollup-task-tracking.ts refactor(zone.js): update Zone bundles to call patch* functions (#53443) 2024-03-15 18:11:33 -07:00
rollup-wtf.ts refactor(zone.js): update Zone bundles to call patch* functions (#53443) 2024-03-15 18:11:33 -07:00
sync-test.ts refactor(zone.js): wrap Zone.__load_patch calls in exported functions (#53443) 2024-03-15 18:11:33 -07:00
task-tracking.ts refactor: migrate zone.js to prettier formatting (#55427) 2024-04-29 09:52:05 -07:00
wtf.ts refactor: migrate zone.js to prettier formatting (#55427) 2024-04-29 09:52:05 -07:00