angular/packages/zone.js/lib/zone-spec
JiaLiPassion dea7234a76 fix(zone.js): async-test should only call done once (#45025)
`AsyncTestZoneSpec` triggers jasmine `done()` function multiple times
and causes warning

```
An asynchronous function called its 'done' callback more than once. This is a bug in the spec, beforeAll, beforeEach, afterAll, or afterEach function in question. This will be treated as an error in a future version. See<https://jasmine.github.io/tutorials/upgrading_to_Jasmine_4.0#deprecations-due-to-calling-done-multiple-times> for more information
```

The reproduce case will be running some `Zone.run()` inside
`waitForAsync()`.

```
it('multiple done', waitForAsync(() => {
  Zone.current.run(() => {});
  Zone.current.run(() => {});
}));
```

The reason the `done()` is called in the `onInvoke()` hook is to handle
the case that the testBody is totally sync, but we should only do this
check for the entry function not for all `Zone.run()` scenario.

Another issue is if we run nested zone inside `waitForAsync()`, the
`onHasTask()` hook will be triggered multiple times, and cause `done()`
be triggered multiple times, so we need to only trigger the `done()`
when the zone is `AsyncTestZone`.

PR Close #45025
2022-02-09 10:18:56 -08:00
..
async-test.ts fix(zone.js): async-test should only call done once (#45025) 2022-02-09 10:18:56 -08:00
fake-async-test.ts feat(core): drop support for zone.js 0.10.x (#40823) 2021-02-24 07:58:29 -08:00
long-stack-trace.ts build: enable useUnknownInCatchVariables (#44679) 2022-02-01 18:17:29 +00:00
proxy.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
sync-test.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
task-tracking.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
wtf.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00