MCPcopy
hub / github.com/angular/angular / waitForAsync

Function waitForAsync

packages/core/testing/src/async.ts:25–45  ·  view source on GitHub ↗
(fn: Function)

Source from the content-addressed store, hash-verified

23 * @publicApi
24 */
25export function waitForAsync(fn: Function): (done: any) => any {
26 const _Zone: any = typeof Zone !== 'undefined' ? Zone : null;
27 if (!_Zone) {
28 return function () {
29 return Promise.reject(
30 'Zone is needed for the waitForAsync() test helper but could not be found. ' +
31 'Please make sure that your environment includes zone.js',
32 );
33 };
34 }
35 const asyncTest = _Zone && _Zone[_Zone.__symbol__('asyncTest')];
36 if (typeof asyncTest === 'function') {
37 return asyncTest(fn);
38 }
39 return function () {
40 return Promise.reject(
41 'zone-testing.js is needed for the async() test helper but could not be found. ' +
42 'Please make sure that your environment includes zone.js/testing',
43 );
44 };
45}

Calls 3

__symbol__Method · 0.80
asyncTestFunction · 0.50
rejectMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…