* 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)
| 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; |
no test coverage detected