mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
`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 |
||
|---|---|---|
| .. | ||
| async-test.ts | ||
| fake-async-test.ts | ||
| long-stack-trace.ts | ||
| proxy.ts | ||
| sync-test.ts | ||
| task-tracking.ts | ||
| wtf.ts | ||