projecte_ionic/node_modules/zone.js/fesm2015/jasmine-patch.min.js
2022-02-09 18:30:03 +01:00

13 lines
4.7 KiB
JavaScript
Executable file

"use strict";
/**
* @license Angular v12.0.0-next.0
* (c) 2010-2020 Google LLC. https://angular.io/
* License: MIT
*/
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/Zone.__load_patch("jasmine",(e,t,n)=>{if(!t)throw new Error("Missing: zone.js");if("undefined"!=typeof jest)return;if("undefined"==typeof jasmine||jasmine.__zone_patch__)return;jasmine.__zone_patch__=!0;const o=t.SyncTestZoneSpec,s=t.ProxyZoneSpec;if(!o)throw new Error("Missing: SyncTestZoneSpec");if(!s)throw new Error("Missing: ProxyZoneSpec");const c=t.current,r=c.fork(new o("jasmine.describe")),i=t.__symbol__,a=!0===e[i("fakeAsyncDisablePatchingClock")],l=!a&&(!0===e[i("fakeAsyncPatchLock")]||!0===e[i("fakeAsyncAutoFakeAsyncWhenClockPatched")]);if(!0!==e[i("ignoreUnhandledRejection")]){const e=jasmine.GlobalErrors;e&&!jasmine[i("GlobalErrors")]&&(jasmine[i("GlobalErrors")]=e,jasmine.GlobalErrors=function(){const t=new e,n=t.install;return n&&!t[i("install")]&&(t[i("install")]=n,t.install=function(){const e=process.listeners("unhandledRejection"),t=n.apply(this,arguments);return process.removeAllListeners("unhandledRejection"),e&&e.forEach(e=>process.on("unhandledRejection",e)),t}),t})}const u=jasmine.getEnv();if(["describe","xdescribe","fdescribe"].forEach(e=>{let t=u[e];u[e]=function(e,n){return t.call(this,e,function o(e){return function(){return r.run(e,this,arguments)}}(n))}}),["it","xit","fit"].forEach(e=>{let t=u[e];u[i(e)]=t,u[e]=function(e,n,o){return arguments[1]=p(n),t.apply(this,arguments)}}),["beforeEach","afterEach","beforeAll","afterAll"].forEach(e=>{let t=u[e];u[i(e)]=t,u[e]=function(e,n){return arguments[0]=p(e),t.apply(this,arguments)}}),!a){const e=jasmine[i("clock")]=jasmine.clock;jasmine.clock=function(){const n=e.apply(this,arguments);if(!n[i("patched")]){n[i("patched")]=i("patched");const e=n[i("tick")]=n.tick;n.tick=function(){const n=t.current.get("FakeAsyncTestZoneSpec");return n?n.tick.apply(n,arguments):e.apply(this,arguments)};const o=n[i("mockDate")]=n.mockDate;n.mockDate=function(){const e=t.current.get("FakeAsyncTestZoneSpec");if(e){const t=arguments.length>0?arguments[0]:new Date;return e.setFakeBaseSystemTime.apply(e,t&&"function"==typeof t.getTime?[t.getTime()]:arguments)}return o.apply(this,arguments)},l&&["install","uninstall"].forEach(e=>{const o=n[i(e)]=n[e];n[e]=function(){const n=t.FakeAsyncTestZoneSpec;if(!n)return o.apply(this,arguments);jasmine[i("clockInstalled")]="install"===e}})}return n}}if(!jasmine[t.__symbol__("createSpyObj")]){const e=jasmine.createSpyObj;jasmine[t.__symbol__("createSpyObj")]=e,jasmine.createSpyObj=function(){const t=Array.prototype.slice.call(arguments),n=t.length>=3?t[2]:null;let o;if(n){const n=Object.defineProperty;Object.defineProperty=function(e,t,o){return n.call(this,e,t,Object.assign(Object.assign({},o),{configurable:!0,enumerable:!0}))};try{o=e.apply(this,t)}finally{Object.defineProperty=n}}else o=e.apply(this,t);return o}}function f(e,n,o,s){const c=!!jasmine[i("clockInstalled")],r=o.testProxyZone;if(c&&l){const n=t[t.__symbol__("fakeAsyncTest")];n&&"function"==typeof n.fakeAsync&&(e=n.fakeAsync(e))}return s?r.run(e,n,[s]):r.run(e,n)}function p(e){return e&&(e.length?function(t){return f(e,this,this.queueRunner,t)}:function(){return f(e,this,this.queueRunner)})}const y=jasmine.QueueRunner;jasmine.QueueRunner=function(n){function o(o){o.onComplete&&(o.onComplete=(e=>()=>{this.testProxyZone=null,this.testProxyZoneSpec=null,c.scheduleMicroTask("jasmine.onComplete",e)})(o.onComplete));const s=e[t.__symbol__("setTimeout")],r=e[t.__symbol__("clearTimeout")];s&&(o.timeout={setTimeout:s||e.setTimeout,clearTimeout:r||e.clearTimeout}),jasmine.UserContext?(o.userContext||(o.userContext=new jasmine.UserContext),o.userContext.queueRunner=this):(o.userContext||(o.userContext={}),o.userContext.queueRunner=this);const i=o.onException;o.onException=function(e){if(e&&"Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL."===e.message){const t=this&&this.testProxyZoneSpec;if(t){const n=t.getAndClearPendingTasksInfo();try{e.message+=n}catch(e){}}}i&&i.call(this,e)},n.call(this,o)}return function(e,t){for(const n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);function n(){this.constructor=e}e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(o,n),o.prototype.execute=function(){let e=t.current,o=!1;for(;e;){if(e===c){o=!0;break}e=e.parent}if(!o)throw new Error("Unexpected Zone: "+t.current.name);this.testProxyZoneSpec=new s,this.testProxyZone=c.fork(this.testProxyZoneSpec),t.currentTask?n.prototype.execute.call(this):t.current.scheduleMicroTask("jasmine.execute().forceTask",()=>y.prototype.execute.call(this))},o}(y)});