MCPcopy Create free account
hub / github.com/angular/angular / wrapTestInZone

Function wrapTestInZone

packages/zone.js/lib/jasmine/jasmine.ts:211–225  ·  view source on GitHub ↗

* Gets a function wrapping the body of a Jasmine `it/beforeEach/afterEach` block to * execute in a ProxyZone zone. * This will run in `testProxyZone`. The `testProxyZone` will be reset by the `ZoneQueueRunner`

(testBody: Function)

Source from the content-addressed store, hash-verified

209 * This will run in `testProxyZone`. The `testProxyZone` will be reset by the `ZoneQueueRunner`
210 */
211 function wrapTestInZone(testBody: Function): Function {
212 // The `done` callback is only passed through if the function expects at least one argument.
213 // Note we have to make a function with correct number of arguments, otherwise jasmine will
214 // think that all functions are sync or async.
215 return (
216 testBody &&
217 (testBody.length
218 ? function (this: QueueRunnerUserContext, done: Function) {
219 return runInTestZone(testBody, this, this.queueRunner!, done);
220 }
221 : function (this: QueueRunnerUserContext) {
222 return runInTestZone(testBody, this, this.queueRunner!);
223 })
224 );
225 }
226 interface QueueRunner {
227 execute(): void;
228 testProxyZoneSpec: ZoneSpec | null;

Callers 1

patchJasmineFunction · 0.70

Calls 1

runInTestZoneFunction · 0.70

Tested by

no test coverage detected