@2112-lab/central-plant 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle/index.js +33146 -1
- package/dist/cjs/_virtual/_rollupPluginBabelHelpers.js +432 -1
- package/dist/cjs/node_modules/@2112-lab/pathfinder/dist/index.esm.js +1448 -1
- package/dist/cjs/node_modules/three/examples/jsm/controls/OrbitControls.js +1853 -1
- package/dist/cjs/node_modules/three/examples/jsm/exporters/GLTFExporter.js +3537 -1
- package/dist/cjs/node_modules/three/examples/jsm/exporters/OBJExporter.js +305 -1
- package/dist/cjs/node_modules/three/examples/jsm/exporters/PLYExporter.js +542 -1
- package/dist/cjs/node_modules/three/examples/jsm/exporters/STLExporter.js +218 -1
- package/dist/cjs/node_modules/three/examples/jsm/loaders/DRACOLoader.js +683 -1
- package/dist/cjs/node_modules/three/examples/jsm/loaders/GLTFLoader.js +4811 -1
- package/dist/cjs/node_modules/three/examples/jsm/loaders/RGBELoader.js +480 -1
- package/dist/cjs/node_modules/three/examples/jsm/renderers/CSS2DRenderer.js +309 -1
- package/dist/cjs/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +120 -1
- package/dist/cjs/src/analysis/analysis.js +560 -1
- package/dist/cjs/src/analysis/testing.js +958 -1
- package/dist/cjs/src/core/centralPlant.js +1149 -1
- package/dist/cjs/src/core/debugLogger.js +175 -1
- package/dist/cjs/src/core/mathUtils.js +574 -1
- package/dist/cjs/src/core/nameUtils.js +93 -1
- package/dist/cjs/src/data/export.js +716 -1
- package/dist/cjs/src/data/import.js +380 -1
- package/dist/cjs/src/data/numerics.js +522 -1
- package/dist/cjs/src/helpers/sceneHelper.js +572 -1
- package/dist/cjs/src/index.js +69 -1
- package/dist/cjs/src/managers/components/animationManager.js +123 -1
- package/dist/cjs/src/managers/components/componentManager.js +332 -1
- package/dist/cjs/src/managers/components/pathfindingManager.js +1441 -1
- package/dist/cjs/src/managers/controls/TransformControls.js +1063 -1
- package/dist/cjs/src/managers/controls/cameraControlsManager.js +79 -1
- package/dist/cjs/src/managers/controls/dragDropManager.js +1026 -1
- package/dist/cjs/src/managers/controls/keyboardControlsManager.js +395 -1
- package/dist/cjs/src/managers/controls/transformControlsManager.js +1807 -1
- package/dist/cjs/src/managers/environment/environmentManager.js +714 -1
- package/dist/cjs/src/managers/environment/textureConfig.js +229 -1
- package/dist/cjs/src/managers/scene/sceneExportManager.js +264 -1
- package/dist/cjs/src/managers/scene/sceneInitializationManager.js +346 -1
- package/dist/cjs/src/managers/scene/sceneOperationsManager.js +1509 -1
- package/dist/cjs/src/managers/scene/sceneTooltipsManager.js +661 -1
- package/dist/cjs/src/managers/system/disposalManager.js +444 -1
- package/dist/cjs/src/managers/system/hotReloadManager.js +291 -1
- package/dist/cjs/src/managers/system/performanceMonitor.js +863 -1
- package/dist/cjs/src/rendering/modelPreloader.js +369 -1
- package/dist/cjs/src/rendering/rendering2D.js +631 -1
- package/dist/cjs/src/rendering/rendering3D.js +685 -1
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +396 -1
- package/dist/esm/node_modules/@2112-lab/pathfinder/dist/index.esm.js +1444 -1
- package/dist/esm/node_modules/three/examples/jsm/controls/OrbitControls.js +1849 -1
- package/dist/esm/node_modules/three/examples/jsm/exporters/GLTFExporter.js +3533 -1
- package/dist/esm/node_modules/three/examples/jsm/exporters/OBJExporter.js +301 -1
- package/dist/esm/node_modules/three/examples/jsm/exporters/PLYExporter.js +538 -1
- package/dist/esm/node_modules/three/examples/jsm/exporters/STLExporter.js +214 -1
- package/dist/esm/node_modules/three/examples/jsm/loaders/DRACOLoader.js +679 -1
- package/dist/esm/node_modules/three/examples/jsm/loaders/GLTFLoader.js +4807 -1
- package/dist/esm/node_modules/three/examples/jsm/loaders/RGBELoader.js +476 -1
- package/dist/esm/node_modules/three/examples/jsm/renderers/CSS2DRenderer.js +304 -1
- package/dist/esm/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +116 -1
- package/dist/esm/src/analysis/analysis.js +536 -1
- package/dist/esm/src/analysis/testing.js +954 -1
- package/dist/esm/src/core/centralPlant.js +1144 -1
- package/dist/esm/src/core/debugLogger.js +167 -1
- package/dist/esm/src/core/mathUtils.js +570 -1
- package/dist/esm/src/core/nameUtils.js +87 -1
- package/dist/esm/src/data/export.js +712 -1
- package/dist/esm/src/data/import.js +356 -1
- package/dist/esm/src/data/numerics.js +518 -1
- package/dist/esm/src/helpers/sceneHelper.js +547 -1
- package/dist/esm/src/index.js +35 -1
- package/dist/esm/src/managers/components/animationManager.js +119 -1
- package/dist/esm/src/managers/components/componentManager.js +328 -1
- package/dist/esm/src/managers/components/pathfindingManager.js +1417 -1
- package/dist/esm/src/managers/controls/TransformControls.js +1057 -1
- package/dist/esm/src/managers/controls/cameraControlsManager.js +75 -1
- package/dist/esm/src/managers/controls/dragDropManager.js +1002 -1
- package/dist/esm/src/managers/controls/keyboardControlsManager.js +371 -1
- package/dist/esm/src/managers/controls/transformControlsManager.js +1782 -1
- package/dist/esm/src/managers/environment/environmentManager.js +690 -1
- package/dist/esm/src/managers/environment/textureConfig.js +202 -1
- package/dist/esm/src/managers/scene/sceneExportManager.js +260 -1
- package/dist/esm/src/managers/scene/sceneInitializationManager.js +322 -1
- package/dist/esm/src/managers/scene/sceneOperationsManager.js +1485 -1
- package/dist/esm/src/managers/scene/sceneTooltipsManager.js +637 -1
- package/dist/esm/src/managers/system/disposalManager.js +440 -1
- package/dist/esm/src/managers/system/hotReloadManager.js +287 -1
- package/dist/esm/src/managers/system/performanceMonitor.js +858 -1
- package/dist/esm/src/rendering/modelPreloader.js +364 -1
- package/dist/esm/src/rendering/rendering2D.js +627 -1
- package/dist/esm/src/rendering/rendering3D.js +661 -1
- package/package.json +1 -1
|
@@ -1 +1,958 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"t",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),t=require("../core/debugLogger.js"),n=function(){return e.createClass(function n(){var r,s=this;e.classCallCheck(this,n),e.defineProperty(this,"mock",{create:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.objectSpread2({calls:[],callCount:0},t);return Object.keys(t).forEach(function(e){var r=t[e];n[e]=function(){for(var t=arguments.length,s=new Array(t),i=0;i<t;i++)s[i]=arguments[i];return n.calls.push({method:e,args:s,timestamp:Date.now()}),n.callCount++,r.apply(void 0,s)}}),n},spy:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},t=function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.calls.push({args:r,timestamp:Date.now()}),t.callCount++,void 0!==t.returnValue?t.returnValue:e.apply(void 0,r)};return t.calls=[],t.callCount=0,t.returnValue=void 0,t.returns=function(e){return t.returnValue=e,t},t.throws=function(e){return t.throwError=e,t},t},three:{vector3:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return{x:e,y:t,z:n,set:function(r,s,i){e=r,t=s,n=i},clone:function(){return{x:e,y:t,z:n}},add:function(r){return{x:e+r.x,y:t+r.y,z:n+r.z}},sub:function(r){return{x:e-r.x,y:t-r.y,z:n-r.z}},length:function(){return Math.sqrt(e*e+t*t+n*n)},normalize:function(){var r=Math.sqrt(e*e+t*t+n*n);return{x:e/r,y:t/r,z:n/r}}}},object3D:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{position:{x:0,y:0,z:0},rotation:{x:0,y:0,z:0},scale:{x:1,y:1,z:1},children:[],parent:null,name:e.name||"",uuid:e.uuid||Math.random().toString(36),add:function(e){this.children.push(e),e.parent=this},remove:function(e){var t=this.children.indexOf(e);t>-1&&this.children.splice(t,1)},traverse:function(e){e(this),this.children.forEach(function(t){return t.traverse(e)})}}},scene:function(){return e.objectSpread2(e.objectSpread2({},s.mock.three.object3D()),{},{background:null,environment:null,fog:null,type:"Scene"})}}}),e.defineProperty(this,"benchmark",{run:(r=e.asyncToGenerator(e.regenerator().m(function n(r,i){var o,a,u,c,f,h,d,l,p,m,v,w,E,g,b,y,k,x,T,M=arguments;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:a=(o=M.length>2&&void 0!==M[2]?M[2]:{}).iterations,u=void 0===a?1e3:a,c=o.warmupIterations,f=void 0===c?10:c,h=o.timeout,d=void 0===h?5e3:h,t.logger.info("⏱️ Running benchmark: ".concat(r)),l=0;case 1:if(!(l<f)){e.n=3;break}return e.n=2,i();case 2:l++,e.n=1;break;case 3:p=[],m=performance.now(),v=0;case 4:if(!(v<u)){e.n=7;break}return w=performance.now(),e.n=5,i();case 5:if(E=performance.now(),p.push(E-w),!(performance.now()-m>d)){e.n=6;break}return t.logger.warn('⚠️ Benchmark "'.concat(r,'" timed out after ').concat(v+1," iterations")),e.a(3,7);case 6:v++,e.n=4;break;case 7:return g=performance.now()-m,b=p.reduce(function(e,t){return e+t},0)/p.length,y=Math.min.apply(Math,p),k=Math.max.apply(Math,p),x=p.sort()[Math.floor(p.length/2)],T={name:r,iterations:p.length,totalTime:g,avgTime:b,minTime:y,maxTime:k,medianTime:x,opsPerSecond:1e3/b},s.benchmarks.set(r,T),t.logger.info('✅ Benchmark "'.concat(r,'" completed: ').concat(T.opsPerSecond.toFixed(2)," ops/sec")),e.a(2,T)}},n)})),function(e,t){return r.apply(this,arguments)}),compare:function(e){var t=e.map(function(e){return s.benchmarks.get(e)}).filter(Boolean);if(t.length<2)throw new Error("Need at least 2 benchmarks to compare");var n=t.reduce(function(e,t){return e.opsPerSecond>t.opsPerSecond?e:t}),r=t.map(function(e){return{name:e.name,opsPerSecond:e.opsPerSecond,relativeSpeed:e.opsPerSecond/n.opsPerSecond,slower:n.opsPerSecond/e.opsPerSecond}});return{fastest:n.name,comparison:r}}}),this.testSuites=new Map,this.testResults=[],this.mockData=new Map,this.assertions=new Map,this.benchmarks=new Map,this.setupDefaultAssertions()},[{key:"setupDefaultAssertions",value:function(){this.addAssertion("equals",function(e,t,n){if(e!==t)throw new Error(n||"Expected ".concat(t,", got ").concat(e))}),this.addAssertion("notEquals",function(e,t,n){if(e===t)throw new Error(n||"Expected not ".concat(t,", got ").concat(e))}),this.addAssertion("deepEquals",function(e,t,n){if(JSON.stringify(e)!==JSON.stringify(t))throw new Error(n||"Deep equality failed")}),this.addAssertion("true",function(e,t){if(!0!==e)throw new Error(t||"Expected true, got ".concat(e))}),this.addAssertion("false",function(e,t){if(!1!==e)throw new Error(t||"Expected false, got ".concat(e))}),this.addAssertion("truthy",function(e,t){if(!e)throw new Error(t||"Expected truthy value, got ".concat(e))}),this.addAssertion("falsy",function(e,t){if(e)throw new Error(t||"Expected falsy value, got ".concat(e))}),this.addAssertion("null",function(e,t){if(null!==e)throw new Error(t||"Expected null, got ".concat(e))}),this.addAssertion("undefined",function(e,t){if(void 0!==e)throw new Error(t||"Expected undefined, got ".concat(e))}),this.addAssertion("defined",function(e,t){if(void 0===e)throw new Error(t||"Expected defined value, got undefined")}),this.addAssertion("instanceOf",function(t,n,r){if(!(t instanceof n))throw new Error(r||"Expected instance of ".concat(n.name,", got ").concat(e.typeof(t)))}),this.addAssertion("typeof",function(t,n,r){if(e.typeof(t)!==n)throw new Error(r||"Expected type ".concat(n,", got ").concat(e.typeof(t)))}),this.addAssertion("greaterThan",function(e,t,n){if(e<=t)throw new Error(n||"Expected ".concat(e," > ").concat(t))}),this.addAssertion("lessThan",function(e,t,n){if(e>=t)throw new Error(n||"Expected ".concat(e," < ").concat(t))}),this.addAssertion("greaterThanOrEqual",function(e,t,n){if(e<t)throw new Error(n||"Expected ".concat(e," >= ").concat(t))}),this.addAssertion("lessThanOrEqual",function(e,t,n){if(e>t)throw new Error(n||"Expected ".concat(e," <= ").concat(t))}),this.addAssertion("approximately",function(e,t,n,r){if(Math.abs(e-t)>n)throw new Error(r||"Expected ".concat(e," ≈ ").concat(t," (±").concat(n,")"))}),this.addAssertion("includes",function(e,t,n){if(!e.includes(t))throw new Error(n||'Expected "'.concat(e,'" to include "').concat(t,'"'))}),this.addAssertion("startsWith",function(e,t,n){if(!e.startsWith(t))throw new Error(n||'Expected "'.concat(e,'" to start with "').concat(t,'"'))}),this.addAssertion("endsWith",function(e,t,n){if(!e.endsWith(t))throw new Error(n||'Expected "'.concat(e,'" to end with "').concat(t,'"'))}),this.addAssertion("matches",function(e,t,n){if(!t.test(e))throw new Error(n||'Expected "'.concat(e,'" to match pattern ').concat(t))}),this.addAssertion("hasLength",function(e,t,n){if(e.length!==t)throw new Error(n||"Expected length ".concat(t,", got ").concat(e.length))}),this.addAssertion("isEmpty",function(e,t){if(0!==e.length)throw new Error(t||"Expected empty array/string, got length ".concat(e.length))}),this.addAssertion("isNotEmpty",function(e,t){if(0===e.length)throw new Error(t||"Expected non-empty array/string")}),this.addAssertion("hasProperty",function(e,t,n){if(!e.hasOwnProperty(t))throw new Error(n||'Expected object to have property "'.concat(t,'"'))}),this.addAssertion("hasMethod",function(e,t,n){if("function"!=typeof e[t])throw new Error(n||'Expected object to have method "'.concat(t,'"'))}),this.addAssertion("resolves",function(){var t=e.asyncToGenerator(e.regenerator().m(function t(n,r){var s;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,n;case 1:e.n=3;break;case 2:throw e.p=2,s=e.v,new Error(r||"Expected promise to resolve, but it rejected: ".concat(s.message));case 3:return e.a(2)}},t,null,[[0,2]])}));return function(e,n){return t.apply(this,arguments)}}()),this.addAssertion("rejects",function(){var t=e.asyncToGenerator(e.regenerator().m(function t(n,r){return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,n;case 1:throw new Error(r||"Expected promise to reject, but it resolved");case 2:e.p=2,e.v;case 3:return e.a(2)}},t,null,[[0,2]])}));return function(e,n){return t.apply(this,arguments)}}()),this.addAssertion("throws",function(e,t){try{throw e(),new Error(t||"Expected function to throw, but it didn't")}catch(e){}})}},{key:"addAssertion",value:function(e,t){this.assertions.set(e,t)}},{key:"createTestSuite",value:function(e){var t=this,n={name:e,tests:[],beforeEach:null,afterEach:null,beforeAll:null,afterAll:null,setup:arguments.length>1&&void 0!==arguments[1]?arguments[1]:null};return this.testSuites.set(e,n),{test:function(n,r){return t.addTest(e,n,r)},beforeEach:function(e){n.beforeEach=e},afterEach:function(e){n.afterEach=e},beforeAll:function(e){n.beforeAll=e},afterAll:function(e){n.afterAll=e}}}},{key:"addTest",value:function(e,t,n){var r=this.testSuites.get(e);if(!r)throw new Error('Test suite "'.concat(e,'" not found'));r.tests.push({name:t,fn:n,skip:!1,only:!1})}},{key:"runAllTests",value:(s=e.asyncToGenerator(e.regenerator().m(function n(){var r,s,i,o,a,u,c,f;return e.regenerator().w(function(n){for(;;)switch(n.n){case 0:t.logger.info("🧪 Running all test suites..."),r=performance.now(),s={suites:[],totalTests:0,passedTests:0,failedTests:0,skippedTests:0,duration:0},i=e.createForOfIteratorHelper(this.testSuites),n.p=1,i.s();case 2:if((o=i.n()).done){n.n=5;break}return a=e.slicedToArray(o.value,2),u=a[0],a[1],n.n=3,this.runTestSuite(u);case 3:c=n.v,s.suites.push(c),s.totalTests+=c.totalTests,s.passedTests+=c.passedTests,s.failedTests+=c.failedTests,s.skippedTests+=c.skippedTests;case 4:n.n=2;break;case 5:n.n=7;break;case 6:n.p=6,f=n.v,i.e(f);case 7:return n.p=7,i.f(),n.f(7);case 8:return s.duration=performance.now()-r,t.logger.info("✅ All tests completed: ".concat(s.passedTests,"/").concat(s.totalTests," passed in ").concat(s.duration.toFixed(2),"ms")),this.testResults.push(s),n.a(2,s)}},n,this,[[1,6,7,8]])})),function(){return s.apply(this,arguments)})},{key:"runTestSuite",value:(r=e.asyncToGenerator(e.regenerator().m(function n(r){var s,i,o,a,u,c,f,h,d;return e.regenerator().w(function(n){for(;;)switch(n.n){case 0:if(s=this.testSuites.get(r)){n.n=1;break}throw new Error('Test suite "'.concat(r,'" not found'));case 1:if(t.logger.info("🧪 Running test suite: ".concat(r)),i=performance.now(),o={name:r,tests:[],totalTests:s.tests.length,passedTests:0,failedTests:0,skippedTests:0,duration:0},n.p=2,!s.setup){n.n=3;break}return n.n=3,s.setup();case 3:if(!s.beforeAll){n.n=4;break}return n.n=4,s.beforeAll();case 4:a=e.createForOfIteratorHelper(s.tests),n.p=5,a.s();case 6:if((u=a.n()).done){n.n=9;break}return c=u.value,n.n=7,this.runTest(s,c);case 7:f=n.v,o.tests.push(f),"passed"===f.status?o.passedTests++:"failed"===f.status?o.failedTests++:"skipped"===f.status&&o.skippedTests++;case 8:n.n=6;break;case 9:n.n=11;break;case 10:n.p=10,h=n.v,a.e(h);case 11:return n.p=11,a.f(),n.f(11);case 12:if(!s.afterAll){n.n=13;break}return n.n=13,s.afterAll();case 13:n.n=15;break;case 14:n.p=14,d=n.v,t.logger.error('❌ Test suite "'.concat(r,'" setup failed:'),d);case 15:return o.duration=performance.now()-i,t.logger.info('✅ Suite "'.concat(r,'" completed: ').concat(o.passedTests,"/").concat(o.totalTests," passed")),n.a(2,o)}},n,this,[[5,10,11,12],[2,14]])})),function(e){return r.apply(this,arguments)})},{key:"runTest",value:(n=e.asyncToGenerator(e.regenerator().m(function n(r,s){var i,o,a,u;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:if(!s.skip){e.n=1;break}return e.a(2,{name:s.name,status:"skipped",duration:0,error:null});case 1:if(i=performance.now(),o={name:s.name,status:"passed",duration:0,error:null},e.p=2,!r.beforeEach){e.n=3;break}return e.n=3,r.beforeEach();case 3:return a=this.createAssertionContext(),e.n=4,s.fn(a);case 4:if(!r.afterEach){e.n=5;break}return e.n=5,r.afterEach();case 5:e.n=7;break;case 6:e.p=6,u=e.v,o.status="failed",o.error={message:u.message,stack:u.stack},t.logger.error('❌ Test "'.concat(s.name,'" failed:'),u.message);case 7:return o.duration=performance.now()-i,e.a(2,o)}},n,this,[[2,6]])})),function(e,t){return n.apply(this,arguments)})},{key:"createAssertionContext",value:function(){var t,n={},r=e.createForOfIteratorHelper(this.assertions);try{for(r.s();!(t=r.n()).done;){var s=e.slicedToArray(t.value,2),i=s[0],o=s[1];n[i]=o}}catch(e){r.e(e)}finally{r.f()}return n}},{key:"generateReport",value:function(e){var t=(e.passedTests/e.totalTests*100).toFixed(1),n='\n<!DOCTYPE html>\n<html>\n<head>\n <title>Test Report</title>\n <style>\n body { font-family: Arial, sans-serif; margin: 20px; }\n .summary { background: #f5f5f5; padding: 15px; border-radius: 5px; margin-bottom: 20px; }\n .suite { margin-bottom: 20px; border: 1px solid #ddd; border-radius: 5px; }\n .suite-header { background: #e9e9e9; padding: 10px; font-weight: bold; }\n .test { padding: 10px; border-bottom: 1px solid #eee; }\n .test:last-child { border-bottom: none; }\n .passed { color: green; }\n .failed { color: red; }\n .skipped { color: orange; }\n .error { background: #ffe6e6; padding: 10px; margin-top: 5px; border-radius: 3px; }\n </style>\n</head>\n<body>\n <h1>Test Report</h1>\n \n <div class="summary">\n <h2>Summary</h2>\n <p><strong>Total Tests:</strong> '.concat(e.totalTests,'</p>\n <p><strong>Passed:</strong> <span class="passed">').concat(e.passedTests,'</span></p>\n <p><strong>Failed:</strong> <span class="failed">').concat(e.failedTests,'</span></p>\n <p><strong>Skipped:</strong> <span class="skipped">').concat(e.skippedTests,"</span></p>\n <p><strong>Pass Rate:</strong> ").concat(t,"%</p>\n <p><strong>Duration:</strong> ").concat(e.duration.toFixed(2),"ms</p>\n </div>\n \n <h2>Test Suites</h2>\n");return e.suites.forEach(function(e){n+='\n <div class="suite">\n <div class="suite-header">\n '.concat(e.name," (").concat(e.passedTests,"/").concat(e.totalTests," passed)\n </div>\n"),e.tests.forEach(function(e){n+='\n <div class="test">\n <span class="'.concat(e.status,'">').concat(e.status.toUpperCase(),"</span>\n <strong>").concat(e.name,"</strong>\n <small>(").concat(e.duration.toFixed(2),"ms)</small>\n"),e.error&&(n+='\n <div class="error">\n <strong>Error:</strong> '.concat(e.error.message,"\n </div>\n")),n+=" </div>"}),n+=" </div>"}),n+="\n</body>\n</html>\n"}},{key:"clearResults",value:function(){this.testResults=[]}},{key:"getResults",value:function(){return this.testResults}},{key:"getBenchmarks",value:function(){return this.benchmarks}},{key:"dispose",value:function(){this.testSuites.clear(),this.clearResults(),this.mockData.clear(),this.benchmarks.clear(),t.logger.info("Testing disposed")}}]);var n,r,s}();exports.Testing=n;
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
6
|
+
var debugLogger = require('../core/debugLogger.js');
|
|
7
|
+
|
|
8
|
+
var Testing = /*#__PURE__*/function () {
|
|
9
|
+
function Testing() {
|
|
10
|
+
var _this = this;
|
|
11
|
+
_rollupPluginBabelHelpers.classCallCheck(this, Testing);
|
|
12
|
+
/**
|
|
13
|
+
* Mock data utilities
|
|
14
|
+
*/
|
|
15
|
+
_rollupPluginBabelHelpers.defineProperty(this, "mock", {
|
|
16
|
+
/**
|
|
17
|
+
* Create mock object
|
|
18
|
+
* @param {Object} methods - Mock methods
|
|
19
|
+
* @returns {Object} Mock object
|
|
20
|
+
*/
|
|
21
|
+
create: function create() {
|
|
22
|
+
var methods = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
23
|
+
var mock = _rollupPluginBabelHelpers.objectSpread2({
|
|
24
|
+
calls: [],
|
|
25
|
+
callCount: 0
|
|
26
|
+
}, methods);
|
|
27
|
+
|
|
28
|
+
// Wrap methods to track calls
|
|
29
|
+
Object.keys(methods).forEach(function (methodName) {
|
|
30
|
+
var originalMethod = methods[methodName];
|
|
31
|
+
mock[methodName] = function () {
|
|
32
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
33
|
+
args[_key] = arguments[_key];
|
|
34
|
+
}
|
|
35
|
+
mock.calls.push({
|
|
36
|
+
method: methodName,
|
|
37
|
+
args: args,
|
|
38
|
+
timestamp: Date.now()
|
|
39
|
+
});
|
|
40
|
+
mock.callCount++;
|
|
41
|
+
return originalMethod.apply(void 0, args);
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
return mock;
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* Create spy function
|
|
48
|
+
* @param {Function} originalFn - Original function to spy on
|
|
49
|
+
* @returns {Function} Spy function
|
|
50
|
+
*/
|
|
51
|
+
spy: function _spy() {
|
|
52
|
+
var originalFn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
|
|
53
|
+
var _spy = function spy() {
|
|
54
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
55
|
+
args[_key2] = arguments[_key2];
|
|
56
|
+
}
|
|
57
|
+
_spy.calls.push({
|
|
58
|
+
args: args,
|
|
59
|
+
timestamp: Date.now()
|
|
60
|
+
});
|
|
61
|
+
_spy.callCount++;
|
|
62
|
+
return _spy.returnValue !== undefined ? _spy.returnValue : originalFn.apply(void 0, args);
|
|
63
|
+
};
|
|
64
|
+
_spy.calls = [];
|
|
65
|
+
_spy.callCount = 0;
|
|
66
|
+
_spy.returnValue = undefined;
|
|
67
|
+
_spy.returns = function (value) {
|
|
68
|
+
_spy.returnValue = value;
|
|
69
|
+
return _spy;
|
|
70
|
+
};
|
|
71
|
+
_spy.throws = function (error) {
|
|
72
|
+
_spy.throwError = error;
|
|
73
|
+
return _spy;
|
|
74
|
+
};
|
|
75
|
+
return _spy;
|
|
76
|
+
},
|
|
77
|
+
/**
|
|
78
|
+
* Mock Three.js objects
|
|
79
|
+
*/
|
|
80
|
+
three: {
|
|
81
|
+
/**
|
|
82
|
+
* Create mock Vector3
|
|
83
|
+
* @param {number} x - X component
|
|
84
|
+
* @param {number} y - Y component
|
|
85
|
+
* @param {number} z - Z component
|
|
86
|
+
* @returns {Object} Mock Vector3
|
|
87
|
+
*/
|
|
88
|
+
vector3: function vector3() {
|
|
89
|
+
var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
90
|
+
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
91
|
+
var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
92
|
+
return {
|
|
93
|
+
x: x,
|
|
94
|
+
y: y,
|
|
95
|
+
z: z,
|
|
96
|
+
set: function set(newX, newY, newZ) {
|
|
97
|
+
x = newX;
|
|
98
|
+
y = newY;
|
|
99
|
+
z = newZ;
|
|
100
|
+
},
|
|
101
|
+
clone: function clone() {
|
|
102
|
+
return {
|
|
103
|
+
x: x,
|
|
104
|
+
y: y,
|
|
105
|
+
z: z
|
|
106
|
+
};
|
|
107
|
+
},
|
|
108
|
+
add: function add(v) {
|
|
109
|
+
return {
|
|
110
|
+
x: x + v.x,
|
|
111
|
+
y: y + v.y,
|
|
112
|
+
z: z + v.z
|
|
113
|
+
};
|
|
114
|
+
},
|
|
115
|
+
sub: function sub(v) {
|
|
116
|
+
return {
|
|
117
|
+
x: x - v.x,
|
|
118
|
+
y: y - v.y,
|
|
119
|
+
z: z - v.z
|
|
120
|
+
};
|
|
121
|
+
},
|
|
122
|
+
length: function length() {
|
|
123
|
+
return Math.sqrt(x * x + y * y + z * z);
|
|
124
|
+
},
|
|
125
|
+
normalize: function normalize() {
|
|
126
|
+
var len = Math.sqrt(x * x + y * y + z * z);
|
|
127
|
+
return {
|
|
128
|
+
x: x / len,
|
|
129
|
+
y: y / len,
|
|
130
|
+
z: z / len
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
},
|
|
135
|
+
/**
|
|
136
|
+
* Create mock Object3D
|
|
137
|
+
* @param {Object} options - Object options
|
|
138
|
+
* @returns {Object} Mock Object3D
|
|
139
|
+
*/
|
|
140
|
+
object3D: function object3D() {
|
|
141
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
142
|
+
return {
|
|
143
|
+
position: {
|
|
144
|
+
x: 0,
|
|
145
|
+
y: 0,
|
|
146
|
+
z: 0
|
|
147
|
+
},
|
|
148
|
+
rotation: {
|
|
149
|
+
x: 0,
|
|
150
|
+
y: 0,
|
|
151
|
+
z: 0
|
|
152
|
+
},
|
|
153
|
+
scale: {
|
|
154
|
+
x: 1,
|
|
155
|
+
y: 1,
|
|
156
|
+
z: 1
|
|
157
|
+
},
|
|
158
|
+
children: [],
|
|
159
|
+
parent: null,
|
|
160
|
+
name: options.name || '',
|
|
161
|
+
uuid: options.uuid || Math.random().toString(36),
|
|
162
|
+
add: function add(child) {
|
|
163
|
+
this.children.push(child);
|
|
164
|
+
child.parent = this;
|
|
165
|
+
},
|
|
166
|
+
remove: function remove(child) {
|
|
167
|
+
var index = this.children.indexOf(child);
|
|
168
|
+
if (index > -1) this.children.splice(index, 1);
|
|
169
|
+
},
|
|
170
|
+
traverse: function traverse(callback) {
|
|
171
|
+
callback(this);
|
|
172
|
+
this.children.forEach(function (child) {
|
|
173
|
+
return child.traverse(callback);
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
},
|
|
178
|
+
/**
|
|
179
|
+
* Create mock Scene
|
|
180
|
+
* @returns {Object} Mock Scene
|
|
181
|
+
*/
|
|
182
|
+
scene: function scene() {
|
|
183
|
+
return _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, _this.mock.three.object3D()), {}, {
|
|
184
|
+
background: null,
|
|
185
|
+
environment: null,
|
|
186
|
+
fog: null,
|
|
187
|
+
type: 'Scene'
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
/**
|
|
193
|
+
* Performance testing utilities
|
|
194
|
+
*/
|
|
195
|
+
_rollupPluginBabelHelpers.defineProperty(this, "benchmark", {
|
|
196
|
+
/**
|
|
197
|
+
* Run performance benchmark
|
|
198
|
+
* @param {string} name - Benchmark name
|
|
199
|
+
* @param {Function} fn - Function to benchmark
|
|
200
|
+
* @param {Object} options - Benchmark options
|
|
201
|
+
* @returns {Promise<Object>} Benchmark results
|
|
202
|
+
*/
|
|
203
|
+
run: function () {
|
|
204
|
+
var _run = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee(name, fn) {
|
|
205
|
+
var options,
|
|
206
|
+
_options$iterations,
|
|
207
|
+
iterations,
|
|
208
|
+
_options$warmupIterat,
|
|
209
|
+
warmupIterations,
|
|
210
|
+
_options$timeout,
|
|
211
|
+
timeout,
|
|
212
|
+
i,
|
|
213
|
+
times,
|
|
214
|
+
startTime,
|
|
215
|
+
_i,
|
|
216
|
+
iterationStart,
|
|
217
|
+
iterationEnd,
|
|
218
|
+
totalTime,
|
|
219
|
+
avgTime,
|
|
220
|
+
minTime,
|
|
221
|
+
maxTime,
|
|
222
|
+
medianTime,
|
|
223
|
+
result,
|
|
224
|
+
_args = arguments;
|
|
225
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context) {
|
|
226
|
+
while (1) switch (_context.n) {
|
|
227
|
+
case 0:
|
|
228
|
+
options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
|
|
229
|
+
_options$iterations = options.iterations, iterations = _options$iterations === void 0 ? 1000 : _options$iterations, _options$warmupIterat = options.warmupIterations, warmupIterations = _options$warmupIterat === void 0 ? 10 : _options$warmupIterat, _options$timeout = options.timeout, timeout = _options$timeout === void 0 ? 5000 : _options$timeout;
|
|
230
|
+
debugLogger.logger.info("\u23F1\uFE0F Running benchmark: ".concat(name));
|
|
231
|
+
|
|
232
|
+
// Warmup
|
|
233
|
+
i = 0;
|
|
234
|
+
case 1:
|
|
235
|
+
if (!(i < warmupIterations)) {
|
|
236
|
+
_context.n = 3;
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
_context.n = 2;
|
|
240
|
+
return fn();
|
|
241
|
+
case 2:
|
|
242
|
+
i++;
|
|
243
|
+
_context.n = 1;
|
|
244
|
+
break;
|
|
245
|
+
case 3:
|
|
246
|
+
// Benchmark
|
|
247
|
+
times = [];
|
|
248
|
+
startTime = performance.now();
|
|
249
|
+
_i = 0;
|
|
250
|
+
case 4:
|
|
251
|
+
if (!(_i < iterations)) {
|
|
252
|
+
_context.n = 7;
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
iterationStart = performance.now();
|
|
256
|
+
_context.n = 5;
|
|
257
|
+
return fn();
|
|
258
|
+
case 5:
|
|
259
|
+
iterationEnd = performance.now();
|
|
260
|
+
times.push(iterationEnd - iterationStart);
|
|
261
|
+
|
|
262
|
+
// Check timeout
|
|
263
|
+
if (!(performance.now() - startTime > timeout)) {
|
|
264
|
+
_context.n = 6;
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
debugLogger.logger.warn("\u26A0\uFE0F Benchmark \"".concat(name, "\" timed out after ").concat(_i + 1, " iterations"));
|
|
268
|
+
return _context.a(3, 7);
|
|
269
|
+
case 6:
|
|
270
|
+
_i++;
|
|
271
|
+
_context.n = 4;
|
|
272
|
+
break;
|
|
273
|
+
case 7:
|
|
274
|
+
// Calculate statistics
|
|
275
|
+
totalTime = performance.now() - startTime;
|
|
276
|
+
avgTime = times.reduce(function (sum, time) {
|
|
277
|
+
return sum + time;
|
|
278
|
+
}, 0) / times.length;
|
|
279
|
+
minTime = Math.min.apply(Math, times);
|
|
280
|
+
maxTime = Math.max.apply(Math, times);
|
|
281
|
+
medianTime = times.sort()[Math.floor(times.length / 2)];
|
|
282
|
+
result = {
|
|
283
|
+
name: name,
|
|
284
|
+
iterations: times.length,
|
|
285
|
+
totalTime: totalTime,
|
|
286
|
+
avgTime: avgTime,
|
|
287
|
+
minTime: minTime,
|
|
288
|
+
maxTime: maxTime,
|
|
289
|
+
medianTime: medianTime,
|
|
290
|
+
opsPerSecond: 1000 / avgTime
|
|
291
|
+
};
|
|
292
|
+
_this.benchmarks.set(name, result);
|
|
293
|
+
debugLogger.logger.info("\u2705 Benchmark \"".concat(name, "\" completed: ").concat(result.opsPerSecond.toFixed(2), " ops/sec"));
|
|
294
|
+
return _context.a(2, result);
|
|
295
|
+
}
|
|
296
|
+
}, _callee);
|
|
297
|
+
}));
|
|
298
|
+
function run(_x, _x2) {
|
|
299
|
+
return _run.apply(this, arguments);
|
|
300
|
+
}
|
|
301
|
+
return run;
|
|
302
|
+
}(),
|
|
303
|
+
/**
|
|
304
|
+
* Compare benchmarks
|
|
305
|
+
* @param {Array} benchmarkNames - Names of benchmarks to compare
|
|
306
|
+
* @returns {Object} Comparison results
|
|
307
|
+
*/
|
|
308
|
+
compare: function compare(benchmarkNames) {
|
|
309
|
+
var results = benchmarkNames.map(function (name) {
|
|
310
|
+
return _this.benchmarks.get(name);
|
|
311
|
+
}).filter(Boolean);
|
|
312
|
+
if (results.length < 2) {
|
|
313
|
+
throw new Error('Need at least 2 benchmarks to compare');
|
|
314
|
+
}
|
|
315
|
+
var fastest = results.reduce(function (prev, current) {
|
|
316
|
+
return prev.opsPerSecond > current.opsPerSecond ? prev : current;
|
|
317
|
+
});
|
|
318
|
+
var comparison = results.map(function (result) {
|
|
319
|
+
return {
|
|
320
|
+
name: result.name,
|
|
321
|
+
opsPerSecond: result.opsPerSecond,
|
|
322
|
+
relativeSpeed: result.opsPerSecond / fastest.opsPerSecond,
|
|
323
|
+
slower: fastest.opsPerSecond / result.opsPerSecond
|
|
324
|
+
};
|
|
325
|
+
});
|
|
326
|
+
return {
|
|
327
|
+
fastest: fastest.name,
|
|
328
|
+
comparison: comparison
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
this.testSuites = new Map();
|
|
333
|
+
this.testResults = [];
|
|
334
|
+
this.mockData = new Map();
|
|
335
|
+
this.assertions = new Map();
|
|
336
|
+
this.benchmarks = new Map();
|
|
337
|
+
this.setupDefaultAssertions();
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Setup default assertion methods
|
|
342
|
+
*/
|
|
343
|
+
return _rollupPluginBabelHelpers.createClass(Testing, [{
|
|
344
|
+
key: "setupDefaultAssertions",
|
|
345
|
+
value: function setupDefaultAssertions() {
|
|
346
|
+
// Basic assertions
|
|
347
|
+
this.addAssertion('equals', function (actual, expected, message) {
|
|
348
|
+
if (actual !== expected) {
|
|
349
|
+
throw new Error(message || "Expected ".concat(expected, ", got ").concat(actual));
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
this.addAssertion('notEquals', function (actual, expected, message) {
|
|
353
|
+
if (actual === expected) {
|
|
354
|
+
throw new Error(message || "Expected not ".concat(expected, ", got ").concat(actual));
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
this.addAssertion('deepEquals', function (actual, expected, message) {
|
|
358
|
+
if (JSON.stringify(actual) !== JSON.stringify(expected)) {
|
|
359
|
+
throw new Error(message || "Deep equality failed");
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
this.addAssertion('true', function (actual, message) {
|
|
363
|
+
if (actual !== true) {
|
|
364
|
+
throw new Error(message || "Expected true, got ".concat(actual));
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
this.addAssertion('false', function (actual, message) {
|
|
368
|
+
if (actual !== false) {
|
|
369
|
+
throw new Error(message || "Expected false, got ".concat(actual));
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
this.addAssertion('truthy', function (actual, message) {
|
|
373
|
+
if (!actual) {
|
|
374
|
+
throw new Error(message || "Expected truthy value, got ".concat(actual));
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
this.addAssertion('falsy', function (actual, message) {
|
|
378
|
+
if (actual) {
|
|
379
|
+
throw new Error(message || "Expected falsy value, got ".concat(actual));
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
this.addAssertion('null', function (actual, message) {
|
|
383
|
+
if (actual !== null) {
|
|
384
|
+
throw new Error(message || "Expected null, got ".concat(actual));
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
this.addAssertion('undefined', function (actual, message) {
|
|
388
|
+
if (actual !== undefined) {
|
|
389
|
+
throw new Error(message || "Expected undefined, got ".concat(actual));
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
this.addAssertion('defined', function (actual, message) {
|
|
393
|
+
if (actual === undefined) {
|
|
394
|
+
throw new Error(message || "Expected defined value, got undefined");
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
// Type assertions
|
|
399
|
+
this.addAssertion('instanceOf', function (actual, expected, message) {
|
|
400
|
+
if (!(actual instanceof expected)) {
|
|
401
|
+
throw new Error(message || "Expected instance of ".concat(expected.name, ", got ").concat(_rollupPluginBabelHelpers["typeof"](actual)));
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
this.addAssertion('typeof', function (actual, expected, message) {
|
|
405
|
+
if (_rollupPluginBabelHelpers["typeof"](actual) !== expected) {
|
|
406
|
+
throw new Error(message || "Expected type ".concat(expected, ", got ").concat(_rollupPluginBabelHelpers["typeof"](actual)));
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
// Numeric assertions
|
|
411
|
+
this.addAssertion('greaterThan', function (actual, expected, message) {
|
|
412
|
+
if (actual <= expected) {
|
|
413
|
+
throw new Error(message || "Expected ".concat(actual, " > ").concat(expected));
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
this.addAssertion('lessThan', function (actual, expected, message) {
|
|
417
|
+
if (actual >= expected) {
|
|
418
|
+
throw new Error(message || "Expected ".concat(actual, " < ").concat(expected));
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
this.addAssertion('greaterThanOrEqual', function (actual, expected, message) {
|
|
422
|
+
if (actual < expected) {
|
|
423
|
+
throw new Error(message || "Expected ".concat(actual, " >= ").concat(expected));
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
this.addAssertion('lessThanOrEqual', function (actual, expected, message) {
|
|
427
|
+
if (actual > expected) {
|
|
428
|
+
throw new Error(message || "Expected ".concat(actual, " <= ").concat(expected));
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
this.addAssertion('approximately', function (actual, expected, delta, message) {
|
|
432
|
+
if (Math.abs(actual - expected) > delta) {
|
|
433
|
+
throw new Error(message || "Expected ".concat(actual, " \u2248 ").concat(expected, " (\xB1").concat(delta, ")"));
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
// String assertions
|
|
438
|
+
this.addAssertion('includes', function (actual, expected, message) {
|
|
439
|
+
if (!actual.includes(expected)) {
|
|
440
|
+
throw new Error(message || "Expected \"".concat(actual, "\" to include \"").concat(expected, "\""));
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
this.addAssertion('startsWith', function (actual, expected, message) {
|
|
444
|
+
if (!actual.startsWith(expected)) {
|
|
445
|
+
throw new Error(message || "Expected \"".concat(actual, "\" to start with \"").concat(expected, "\""));
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
this.addAssertion('endsWith', function (actual, expected, message) {
|
|
449
|
+
if (!actual.endsWith(expected)) {
|
|
450
|
+
throw new Error(message || "Expected \"".concat(actual, "\" to end with \"").concat(expected, "\""));
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
this.addAssertion('matches', function (actual, pattern, message) {
|
|
454
|
+
if (!pattern.test(actual)) {
|
|
455
|
+
throw new Error(message || "Expected \"".concat(actual, "\" to match pattern ").concat(pattern));
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
// Array assertions
|
|
460
|
+
this.addAssertion('hasLength', function (actual, expected, message) {
|
|
461
|
+
if (actual.length !== expected) {
|
|
462
|
+
throw new Error(message || "Expected length ".concat(expected, ", got ").concat(actual.length));
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
this.addAssertion('isEmpty', function (actual, message) {
|
|
466
|
+
if (actual.length !== 0) {
|
|
467
|
+
throw new Error(message || "Expected empty array/string, got length ".concat(actual.length));
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
this.addAssertion('isNotEmpty', function (actual, message) {
|
|
471
|
+
if (actual.length === 0) {
|
|
472
|
+
throw new Error(message || "Expected non-empty array/string");
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
// Object assertions
|
|
477
|
+
this.addAssertion('hasProperty', function (actual, property, message) {
|
|
478
|
+
if (!actual.hasOwnProperty(property)) {
|
|
479
|
+
throw new Error(message || "Expected object to have property \"".concat(property, "\""));
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
this.addAssertion('hasMethod', function (actual, method, message) {
|
|
483
|
+
if (typeof actual[method] !== 'function') {
|
|
484
|
+
throw new Error(message || "Expected object to have method \"".concat(method, "\""));
|
|
485
|
+
}
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
// Async assertions
|
|
489
|
+
this.addAssertion('resolves', /*#__PURE__*/function () {
|
|
490
|
+
var _ref = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee2(promise, message) {
|
|
491
|
+
var _t;
|
|
492
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context2) {
|
|
493
|
+
while (1) switch (_context2.n) {
|
|
494
|
+
case 0:
|
|
495
|
+
_context2.p = 0;
|
|
496
|
+
_context2.n = 1;
|
|
497
|
+
return promise;
|
|
498
|
+
case 1:
|
|
499
|
+
_context2.n = 3;
|
|
500
|
+
break;
|
|
501
|
+
case 2:
|
|
502
|
+
_context2.p = 2;
|
|
503
|
+
_t = _context2.v;
|
|
504
|
+
throw new Error(message || "Expected promise to resolve, but it rejected: ".concat(_t.message));
|
|
505
|
+
case 3:
|
|
506
|
+
return _context2.a(2);
|
|
507
|
+
}
|
|
508
|
+
}, _callee2, null, [[0, 2]]);
|
|
509
|
+
}));
|
|
510
|
+
return function (_x3, _x4) {
|
|
511
|
+
return _ref.apply(this, arguments);
|
|
512
|
+
};
|
|
513
|
+
}());
|
|
514
|
+
this.addAssertion('rejects', /*#__PURE__*/function () {
|
|
515
|
+
var _ref2 = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee3(promise, message) {
|
|
516
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context3) {
|
|
517
|
+
while (1) switch (_context3.n) {
|
|
518
|
+
case 0:
|
|
519
|
+
_context3.p = 0;
|
|
520
|
+
_context3.n = 1;
|
|
521
|
+
return promise;
|
|
522
|
+
case 1:
|
|
523
|
+
throw new Error(message || "Expected promise to reject, but it resolved");
|
|
524
|
+
case 2:
|
|
525
|
+
_context3.p = 2;
|
|
526
|
+
_context3.v;
|
|
527
|
+
case 3:
|
|
528
|
+
return _context3.a(2);
|
|
529
|
+
}
|
|
530
|
+
}, _callee3, null, [[0, 2]]);
|
|
531
|
+
}));
|
|
532
|
+
return function (_x5, _x6) {
|
|
533
|
+
return _ref2.apply(this, arguments);
|
|
534
|
+
};
|
|
535
|
+
}());
|
|
536
|
+
this.addAssertion('throws', function (fn, message) {
|
|
537
|
+
try {
|
|
538
|
+
fn();
|
|
539
|
+
throw new Error(message || "Expected function to throw, but it didn't");
|
|
540
|
+
} catch (error) {
|
|
541
|
+
// Expected behavior
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Add custom assertion
|
|
548
|
+
* @param {string} name - Assertion name
|
|
549
|
+
* @param {Function} assertionFn - Assertion function
|
|
550
|
+
*/
|
|
551
|
+
}, {
|
|
552
|
+
key: "addAssertion",
|
|
553
|
+
value: function addAssertion(name, assertionFn) {
|
|
554
|
+
this.assertions.set(name, assertionFn);
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* Create test suite
|
|
559
|
+
* @param {string} name - Suite name
|
|
560
|
+
* @param {Function} setupFn - Setup function
|
|
561
|
+
* @returns {Object} Test suite object
|
|
562
|
+
*/
|
|
563
|
+
}, {
|
|
564
|
+
key: "createTestSuite",
|
|
565
|
+
value: function createTestSuite(name) {
|
|
566
|
+
var _this2 = this;
|
|
567
|
+
var setupFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
568
|
+
var suite = {
|
|
569
|
+
name: name,
|
|
570
|
+
tests: [],
|
|
571
|
+
beforeEach: null,
|
|
572
|
+
afterEach: null,
|
|
573
|
+
beforeAll: null,
|
|
574
|
+
afterAll: null,
|
|
575
|
+
setup: setupFn
|
|
576
|
+
};
|
|
577
|
+
this.testSuites.set(name, suite);
|
|
578
|
+
return {
|
|
579
|
+
test: function test(testName, testFn) {
|
|
580
|
+
return _this2.addTest(name, testName, testFn);
|
|
581
|
+
},
|
|
582
|
+
beforeEach: function beforeEach(fn) {
|
|
583
|
+
suite.beforeEach = fn;
|
|
584
|
+
},
|
|
585
|
+
afterEach: function afterEach(fn) {
|
|
586
|
+
suite.afterEach = fn;
|
|
587
|
+
},
|
|
588
|
+
beforeAll: function beforeAll(fn) {
|
|
589
|
+
suite.beforeAll = fn;
|
|
590
|
+
},
|
|
591
|
+
afterAll: function afterAll(fn) {
|
|
592
|
+
suite.afterAll = fn;
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Add test to suite
|
|
599
|
+
* @param {string} suiteName - Suite name
|
|
600
|
+
* @param {string} testName - Test name
|
|
601
|
+
* @param {Function} testFn - Test function
|
|
602
|
+
*/
|
|
603
|
+
}, {
|
|
604
|
+
key: "addTest",
|
|
605
|
+
value: function addTest(suiteName, testName, testFn) {
|
|
606
|
+
var suite = this.testSuites.get(suiteName);
|
|
607
|
+
if (!suite) {
|
|
608
|
+
throw new Error("Test suite \"".concat(suiteName, "\" not found"));
|
|
609
|
+
}
|
|
610
|
+
suite.tests.push({
|
|
611
|
+
name: testName,
|
|
612
|
+
fn: testFn,
|
|
613
|
+
skip: false,
|
|
614
|
+
only: false
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* Run all test suites
|
|
620
|
+
* @returns {Promise<Object>} Test results
|
|
621
|
+
*/
|
|
622
|
+
}, {
|
|
623
|
+
key: "runAllTests",
|
|
624
|
+
value: (function () {
|
|
625
|
+
var _runAllTests = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee4() {
|
|
626
|
+
var startTime, results, _iterator, _step, _step$value, suiteName, suiteResult, _t3;
|
|
627
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context4) {
|
|
628
|
+
while (1) switch (_context4.n) {
|
|
629
|
+
case 0:
|
|
630
|
+
debugLogger.logger.info('🧪 Running all test suites...');
|
|
631
|
+
startTime = performance.now();
|
|
632
|
+
results = {
|
|
633
|
+
suites: [],
|
|
634
|
+
totalTests: 0,
|
|
635
|
+
passedTests: 0,
|
|
636
|
+
failedTests: 0,
|
|
637
|
+
skippedTests: 0,
|
|
638
|
+
duration: 0
|
|
639
|
+
};
|
|
640
|
+
_iterator = _rollupPluginBabelHelpers.createForOfIteratorHelper(this.testSuites);
|
|
641
|
+
_context4.p = 1;
|
|
642
|
+
_iterator.s();
|
|
643
|
+
case 2:
|
|
644
|
+
if ((_step = _iterator.n()).done) {
|
|
645
|
+
_context4.n = 5;
|
|
646
|
+
break;
|
|
647
|
+
}
|
|
648
|
+
_step$value = _rollupPluginBabelHelpers.slicedToArray(_step.value, 2), suiteName = _step$value[0], _step$value[1];
|
|
649
|
+
_context4.n = 3;
|
|
650
|
+
return this.runTestSuite(suiteName);
|
|
651
|
+
case 3:
|
|
652
|
+
suiteResult = _context4.v;
|
|
653
|
+
results.suites.push(suiteResult);
|
|
654
|
+
results.totalTests += suiteResult.totalTests;
|
|
655
|
+
results.passedTests += suiteResult.passedTests;
|
|
656
|
+
results.failedTests += suiteResult.failedTests;
|
|
657
|
+
results.skippedTests += suiteResult.skippedTests;
|
|
658
|
+
case 4:
|
|
659
|
+
_context4.n = 2;
|
|
660
|
+
break;
|
|
661
|
+
case 5:
|
|
662
|
+
_context4.n = 7;
|
|
663
|
+
break;
|
|
664
|
+
case 6:
|
|
665
|
+
_context4.p = 6;
|
|
666
|
+
_t3 = _context4.v;
|
|
667
|
+
_iterator.e(_t3);
|
|
668
|
+
case 7:
|
|
669
|
+
_context4.p = 7;
|
|
670
|
+
_iterator.f();
|
|
671
|
+
return _context4.f(7);
|
|
672
|
+
case 8:
|
|
673
|
+
results.duration = performance.now() - startTime;
|
|
674
|
+
debugLogger.logger.info("\u2705 All tests completed: ".concat(results.passedTests, "/").concat(results.totalTests, " passed in ").concat(results.duration.toFixed(2), "ms"));
|
|
675
|
+
this.testResults.push(results);
|
|
676
|
+
return _context4.a(2, results);
|
|
677
|
+
}
|
|
678
|
+
}, _callee4, this, [[1, 6, 7, 8]]);
|
|
679
|
+
}));
|
|
680
|
+
function runAllTests() {
|
|
681
|
+
return _runAllTests.apply(this, arguments);
|
|
682
|
+
}
|
|
683
|
+
return runAllTests;
|
|
684
|
+
}()
|
|
685
|
+
/**
|
|
686
|
+
* Run specific test suite
|
|
687
|
+
* @param {string} suiteName - Suite name
|
|
688
|
+
* @returns {Promise<Object>} Suite results
|
|
689
|
+
*/
|
|
690
|
+
)
|
|
691
|
+
}, {
|
|
692
|
+
key: "runTestSuite",
|
|
693
|
+
value: (function () {
|
|
694
|
+
var _runTestSuite = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee5(suiteName) {
|
|
695
|
+
var suite, startTime, result, _iterator2, _step2, test, testResult, _t4, _t5;
|
|
696
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context5) {
|
|
697
|
+
while (1) switch (_context5.n) {
|
|
698
|
+
case 0:
|
|
699
|
+
suite = this.testSuites.get(suiteName);
|
|
700
|
+
if (suite) {
|
|
701
|
+
_context5.n = 1;
|
|
702
|
+
break;
|
|
703
|
+
}
|
|
704
|
+
throw new Error("Test suite \"".concat(suiteName, "\" not found"));
|
|
705
|
+
case 1:
|
|
706
|
+
debugLogger.logger.info("\uD83E\uDDEA Running test suite: ".concat(suiteName));
|
|
707
|
+
startTime = performance.now();
|
|
708
|
+
result = {
|
|
709
|
+
name: suiteName,
|
|
710
|
+
tests: [],
|
|
711
|
+
totalTests: suite.tests.length,
|
|
712
|
+
passedTests: 0,
|
|
713
|
+
failedTests: 0,
|
|
714
|
+
skippedTests: 0,
|
|
715
|
+
duration: 0
|
|
716
|
+
};
|
|
717
|
+
_context5.p = 2;
|
|
718
|
+
if (!suite.setup) {
|
|
719
|
+
_context5.n = 3;
|
|
720
|
+
break;
|
|
721
|
+
}
|
|
722
|
+
_context5.n = 3;
|
|
723
|
+
return suite.setup();
|
|
724
|
+
case 3:
|
|
725
|
+
if (!suite.beforeAll) {
|
|
726
|
+
_context5.n = 4;
|
|
727
|
+
break;
|
|
728
|
+
}
|
|
729
|
+
_context5.n = 4;
|
|
730
|
+
return suite.beforeAll();
|
|
731
|
+
case 4:
|
|
732
|
+
// Run tests
|
|
733
|
+
_iterator2 = _rollupPluginBabelHelpers.createForOfIteratorHelper(suite.tests);
|
|
734
|
+
_context5.p = 5;
|
|
735
|
+
_iterator2.s();
|
|
736
|
+
case 6:
|
|
737
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
738
|
+
_context5.n = 9;
|
|
739
|
+
break;
|
|
740
|
+
}
|
|
741
|
+
test = _step2.value;
|
|
742
|
+
_context5.n = 7;
|
|
743
|
+
return this.runTest(suite, test);
|
|
744
|
+
case 7:
|
|
745
|
+
testResult = _context5.v;
|
|
746
|
+
result.tests.push(testResult);
|
|
747
|
+
if (testResult.status === 'passed') result.passedTests++;else if (testResult.status === 'failed') result.failedTests++;else if (testResult.status === 'skipped') result.skippedTests++;
|
|
748
|
+
case 8:
|
|
749
|
+
_context5.n = 6;
|
|
750
|
+
break;
|
|
751
|
+
case 9:
|
|
752
|
+
_context5.n = 11;
|
|
753
|
+
break;
|
|
754
|
+
case 10:
|
|
755
|
+
_context5.p = 10;
|
|
756
|
+
_t4 = _context5.v;
|
|
757
|
+
_iterator2.e(_t4);
|
|
758
|
+
case 11:
|
|
759
|
+
_context5.p = 11;
|
|
760
|
+
_iterator2.f();
|
|
761
|
+
return _context5.f(11);
|
|
762
|
+
case 12:
|
|
763
|
+
if (!suite.afterAll) {
|
|
764
|
+
_context5.n = 13;
|
|
765
|
+
break;
|
|
766
|
+
}
|
|
767
|
+
_context5.n = 13;
|
|
768
|
+
return suite.afterAll();
|
|
769
|
+
case 13:
|
|
770
|
+
_context5.n = 15;
|
|
771
|
+
break;
|
|
772
|
+
case 14:
|
|
773
|
+
_context5.p = 14;
|
|
774
|
+
_t5 = _context5.v;
|
|
775
|
+
debugLogger.logger.error("\u274C Test suite \"".concat(suiteName, "\" setup failed:"), _t5);
|
|
776
|
+
case 15:
|
|
777
|
+
result.duration = performance.now() - startTime;
|
|
778
|
+
debugLogger.logger.info("\u2705 Suite \"".concat(suiteName, "\" completed: ").concat(result.passedTests, "/").concat(result.totalTests, " passed"));
|
|
779
|
+
return _context5.a(2, result);
|
|
780
|
+
}
|
|
781
|
+
}, _callee5, this, [[5, 10, 11, 12], [2, 14]]);
|
|
782
|
+
}));
|
|
783
|
+
function runTestSuite(_x7) {
|
|
784
|
+
return _runTestSuite.apply(this, arguments);
|
|
785
|
+
}
|
|
786
|
+
return runTestSuite;
|
|
787
|
+
}()
|
|
788
|
+
/**
|
|
789
|
+
* Run individual test
|
|
790
|
+
* @param {Object} suite - Test suite
|
|
791
|
+
* @param {Object} test - Test object
|
|
792
|
+
* @returns {Promise<Object>} Test result
|
|
793
|
+
*/
|
|
794
|
+
)
|
|
795
|
+
}, {
|
|
796
|
+
key: "runTest",
|
|
797
|
+
value: (function () {
|
|
798
|
+
var _runTest = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee6(suite, test) {
|
|
799
|
+
var startTime, result, assert, _t6;
|
|
800
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context6) {
|
|
801
|
+
while (1) switch (_context6.n) {
|
|
802
|
+
case 0:
|
|
803
|
+
if (!test.skip) {
|
|
804
|
+
_context6.n = 1;
|
|
805
|
+
break;
|
|
806
|
+
}
|
|
807
|
+
return _context6.a(2, {
|
|
808
|
+
name: test.name,
|
|
809
|
+
status: 'skipped',
|
|
810
|
+
duration: 0,
|
|
811
|
+
error: null
|
|
812
|
+
});
|
|
813
|
+
case 1:
|
|
814
|
+
startTime = performance.now();
|
|
815
|
+
result = {
|
|
816
|
+
name: test.name,
|
|
817
|
+
status: 'passed',
|
|
818
|
+
duration: 0,
|
|
819
|
+
error: null
|
|
820
|
+
};
|
|
821
|
+
_context6.p = 2;
|
|
822
|
+
if (!suite.beforeEach) {
|
|
823
|
+
_context6.n = 3;
|
|
824
|
+
break;
|
|
825
|
+
}
|
|
826
|
+
_context6.n = 3;
|
|
827
|
+
return suite.beforeEach();
|
|
828
|
+
case 3:
|
|
829
|
+
// Create assertion context
|
|
830
|
+
assert = this.createAssertionContext(); // Run test
|
|
831
|
+
_context6.n = 4;
|
|
832
|
+
return test.fn(assert);
|
|
833
|
+
case 4:
|
|
834
|
+
if (!suite.afterEach) {
|
|
835
|
+
_context6.n = 5;
|
|
836
|
+
break;
|
|
837
|
+
}
|
|
838
|
+
_context6.n = 5;
|
|
839
|
+
return suite.afterEach();
|
|
840
|
+
case 5:
|
|
841
|
+
_context6.n = 7;
|
|
842
|
+
break;
|
|
843
|
+
case 6:
|
|
844
|
+
_context6.p = 6;
|
|
845
|
+
_t6 = _context6.v;
|
|
846
|
+
result.status = 'failed';
|
|
847
|
+
result.error = {
|
|
848
|
+
message: _t6.message,
|
|
849
|
+
stack: _t6.stack
|
|
850
|
+
};
|
|
851
|
+
debugLogger.logger.error("\u274C Test \"".concat(test.name, "\" failed:"), _t6.message);
|
|
852
|
+
case 7:
|
|
853
|
+
result.duration = performance.now() - startTime;
|
|
854
|
+
return _context6.a(2, result);
|
|
855
|
+
}
|
|
856
|
+
}, _callee6, this, [[2, 6]]);
|
|
857
|
+
}));
|
|
858
|
+
function runTest(_x8, _x9) {
|
|
859
|
+
return _runTest.apply(this, arguments);
|
|
860
|
+
}
|
|
861
|
+
return runTest;
|
|
862
|
+
}()
|
|
863
|
+
/**
|
|
864
|
+
* Create assertion context for tests
|
|
865
|
+
* @returns {Object} Assertion methods
|
|
866
|
+
*/
|
|
867
|
+
)
|
|
868
|
+
}, {
|
|
869
|
+
key: "createAssertionContext",
|
|
870
|
+
value: function createAssertionContext() {
|
|
871
|
+
var context = {};
|
|
872
|
+
var _iterator3 = _rollupPluginBabelHelpers.createForOfIteratorHelper(this.assertions),
|
|
873
|
+
_step3;
|
|
874
|
+
try {
|
|
875
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
876
|
+
var _step3$value = _rollupPluginBabelHelpers.slicedToArray(_step3.value, 2),
|
|
877
|
+
name = _step3$value[0],
|
|
878
|
+
assertionFn = _step3$value[1];
|
|
879
|
+
context[name] = assertionFn;
|
|
880
|
+
}
|
|
881
|
+
} catch (err) {
|
|
882
|
+
_iterator3.e(err);
|
|
883
|
+
} finally {
|
|
884
|
+
_iterator3.f();
|
|
885
|
+
}
|
|
886
|
+
return context;
|
|
887
|
+
}
|
|
888
|
+
}, {
|
|
889
|
+
key: "generateReport",
|
|
890
|
+
value:
|
|
891
|
+
/**
|
|
892
|
+
* Generate test report
|
|
893
|
+
* @param {Object} results - Test results
|
|
894
|
+
* @returns {string} HTML report
|
|
895
|
+
*/
|
|
896
|
+
function generateReport(results) {
|
|
897
|
+
var passRate = (results.passedTests / results.totalTests * 100).toFixed(1);
|
|
898
|
+
var html = "\n<!DOCTYPE html>\n<html>\n<head>\n <title>Test Report</title>\n <style>\n body { font-family: Arial, sans-serif; margin: 20px; }\n .summary { background: #f5f5f5; padding: 15px; border-radius: 5px; margin-bottom: 20px; }\n .suite { margin-bottom: 20px; border: 1px solid #ddd; border-radius: 5px; }\n .suite-header { background: #e9e9e9; padding: 10px; font-weight: bold; }\n .test { padding: 10px; border-bottom: 1px solid #eee; }\n .test:last-child { border-bottom: none; }\n .passed { color: green; }\n .failed { color: red; }\n .skipped { color: orange; }\n .error { background: #ffe6e6; padding: 10px; margin-top: 5px; border-radius: 3px; }\n </style>\n</head>\n<body>\n <h1>Test Report</h1>\n \n <div class=\"summary\">\n <h2>Summary</h2>\n <p><strong>Total Tests:</strong> ".concat(results.totalTests, "</p>\n <p><strong>Passed:</strong> <span class=\"passed\">").concat(results.passedTests, "</span></p>\n <p><strong>Failed:</strong> <span class=\"failed\">").concat(results.failedTests, "</span></p>\n <p><strong>Skipped:</strong> <span class=\"skipped\">").concat(results.skippedTests, "</span></p>\n <p><strong>Pass Rate:</strong> ").concat(passRate, "%</p>\n <p><strong>Duration:</strong> ").concat(results.duration.toFixed(2), "ms</p>\n </div>\n \n <h2>Test Suites</h2>\n");
|
|
899
|
+
results.suites.forEach(function (suite) {
|
|
900
|
+
html += "\n <div class=\"suite\">\n <div class=\"suite-header\">\n ".concat(suite.name, " (").concat(suite.passedTests, "/").concat(suite.totalTests, " passed)\n </div>\n");
|
|
901
|
+
suite.tests.forEach(function (test) {
|
|
902
|
+
html += "\n <div class=\"test\">\n <span class=\"".concat(test.status, "\">").concat(test.status.toUpperCase(), "</span>\n <strong>").concat(test.name, "</strong>\n <small>(").concat(test.duration.toFixed(2), "ms)</small>\n");
|
|
903
|
+
if (test.error) {
|
|
904
|
+
html += "\n <div class=\"error\">\n <strong>Error:</strong> ".concat(test.error.message, "\n </div>\n");
|
|
905
|
+
}
|
|
906
|
+
html += ' </div>';
|
|
907
|
+
});
|
|
908
|
+
html += ' </div>';
|
|
909
|
+
});
|
|
910
|
+
html += "\n</body>\n</html>\n";
|
|
911
|
+
return html;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* Clear test results
|
|
916
|
+
*/
|
|
917
|
+
}, {
|
|
918
|
+
key: "clearResults",
|
|
919
|
+
value: function clearResults() {
|
|
920
|
+
this.testResults = [];
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* Get test results
|
|
925
|
+
* @returns {Array} Test results
|
|
926
|
+
*/
|
|
927
|
+
}, {
|
|
928
|
+
key: "getResults",
|
|
929
|
+
value: function getResults() {
|
|
930
|
+
return this.testResults;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
/**
|
|
934
|
+
* Get benchmark results
|
|
935
|
+
* @returns {Map} Benchmark results
|
|
936
|
+
*/
|
|
937
|
+
}, {
|
|
938
|
+
key: "getBenchmarks",
|
|
939
|
+
value: function getBenchmarks() {
|
|
940
|
+
return this.benchmarks;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
/**
|
|
944
|
+
* Dispose of testing manager
|
|
945
|
+
*/
|
|
946
|
+
}, {
|
|
947
|
+
key: "dispose",
|
|
948
|
+
value: function dispose() {
|
|
949
|
+
this.testSuites.clear();
|
|
950
|
+
this.clearResults();
|
|
951
|
+
this.mockData.clear();
|
|
952
|
+
this.benchmarks.clear();
|
|
953
|
+
debugLogger.logger.info('Testing disposed');
|
|
954
|
+
}
|
|
955
|
+
}]);
|
|
956
|
+
}();
|
|
957
|
+
|
|
958
|
+
exports.Testing = Testing;
|