(this: QueueRunner, attrs: QueueRunnerAttrs)
| 250 | privateApis.QueueRunner = (function (_super) { |
| 251 | __extends(ZoneQueueRunner, _super); |
| 252 | function ZoneQueueRunner(this: QueueRunner, attrs: QueueRunnerAttrs) { |
| 253 | if (attrs.onComplete) { |
| 254 | attrs.onComplete = ((fn) => () => { |
| 255 | // All functions are done, clear the test zone. |
| 256 | this.testProxyZone = null; |
| 257 | this.testProxyZoneSpec = null; |
| 258 | ambientZone.scheduleMicroTask('jasmine.onComplete', fn); |
| 259 | })(attrs.onComplete); |
| 260 | } |
| 261 | |
| 262 | const nativeSetTimeout = global[Zone.__symbol__('setTimeout')]; |
| 263 | const nativeClearTimeout = global[Zone.__symbol__('clearTimeout')]; |
| 264 | if (nativeSetTimeout) { |
| 265 | // should run setTimeout inside jasmine outside of zone |
| 266 | attrs.timeout = { |
| 267 | setTimeout: nativeSetTimeout ? nativeSetTimeout : global.setTimeout, |
| 268 | clearTimeout: nativeClearTimeout ? nativeClearTimeout : global.clearTimeout, |
| 269 | }; |
| 270 | } |
| 271 | |
| 272 | // create a userContext to hold the queueRunner itself |
| 273 | // so we can access the testProxy in it/xit/beforeEach ... |
| 274 | if (privateApis.UserContext) { |
| 275 | if (!attrs.userContext) { |
| 276 | attrs.userContext = new privateApis.UserContext(); |
| 277 | } |
| 278 | attrs.userContext.queueRunner = this; |
| 279 | } else { |
| 280 | if (!attrs.userContext) { |
| 281 | attrs.userContext = {}; |
| 282 | } |
| 283 | attrs.userContext.queueRunner = this; |
| 284 | } |
| 285 | |
| 286 | // patch attrs.onException |
| 287 | const onException = attrs.onException; |
| 288 | attrs.onException = function (this: undefined | QueueRunner, error: any) { |
| 289 | if ( |
| 290 | error && |
| 291 | error.message === |
| 292 | 'Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.' |
| 293 | ) { |
| 294 | // jasmine timeout, we can make the error message more |
| 295 | // reasonable to tell what tasks are pending |
| 296 | const proxyZoneSpec: any = this && this.testProxyZoneSpec; |
| 297 | if (proxyZoneSpec) { |
| 298 | const pendingTasksInfo = proxyZoneSpec.getAndClearPendingTasksInfo(); |
| 299 | try { |
| 300 | // try catch here in case error.message is not writable |
| 301 | error.message += pendingTasksInfo; |
| 302 | } catch (err) {} |
| 303 | } |
| 304 | } |
| 305 | if (onException) { |
| 306 | onException.call(this, error); |
| 307 | } |
| 308 | }; |
| 309 |
nothing calls this directly
no test coverage detected
searching dependent graphs…