Files
xinnengyuan/node_modules/@amap/amap-jsapi-loader/example/libs/mocha.min.js

2 lines
55 KiB
JavaScript
Raw Normal View History

!function(){function t(e){var n=t.resolve(e),r=t.modules[n];if(!r)throw new Error('failed to require "'+e+'"');return r.exports||(r.exports={},r.call(r.exports,r,r.exports,t.relative(n))),r.exports}function e(){for(var t=(new r).getTime();f.length&&(new r).getTime()-t<100;)f.shift()();l=f.length?o(e,0):null}t.modules={},t.resolve=function(e){var n=e,r=e+".js",o=e+"/index.js";return t.modules[r]&&r||t.modules[o]&&o||n},t.register=function(e,n){t.modules[e]=n},t.relative=function(e){return function(n){if("."!=n.charAt(0))return t(n);var r=e.split("/"),o=n.split("/");r.pop();for(var i=0;i<o.length;i++){var s=o[i];".."==s?r.pop():"."!=s&&r.push(s)}return t(r.join("/"))}},t.register("browser/debug.js",function(t){t.exports=function(){return function(){}}}),t.register("browser/diff.js",function(t){var e=function(){function t(t){return{newPos:t.newPos,components:t.components.slice(0)}}function e(t){for(var e=[],n=0;n<t.length;n++)t[n]&&e.push(t[n]);return e}function n(t){var e=t;return e=e.replace(/&/g,"&amp;"),e=e.replace(/</g,"&lt;"),e=e.replace(/>/g,"&gt;"),e=e.replace(/"/g,"&quot;")}var r=function(t){this.ignoreWhitespace=t};r.prototype={diff:function(e,n){if(n===e)return[{value:n}];if(!n)return[{value:e,removed:!0}];if(!e)return[{value:n,added:!0}];n=this.tokenize(n),e=this.tokenize(e);var r=n.length,o=e.length,i=r+o,s=[{newPos:-1,components:[]}],a=this.extractCommon(s[0],n,e,0);if(s[0].newPos+1>=r&&a+1>=o)return s[0].components;for(var u=1;i>=u;u++)for(var c=-1*u;u>=c;c+=2){var l,f=s[c-1],p=s[c+1];a=(p?p.newPos:0)-c,f&&(s[c-1]=void 0);var h=f&&f.newPos+1<r,d=p&&a>=0&&o>a;if(h||d){!h||d&&f.newPos<p.newPos?(l=t(p),this.pushComponent(l.components,e[a],void 0,!0)):(l=t(f),l.newPos++,this.pushComponent(l.components,n[l.newPos],!0,void 0));var a=this.extractCommon(l,n,e,c);if(l.newPos+1>=r&&a+1>=o)return l.components;s[c]=l}else s[c]=void 0}},pushComponent:function(t,e,n,r){var o=t[t.length-1];o&&o.added===n&&o.removed===r?t[t.length-1]={value:this.join(o.value,e),added:n,removed:r}:t.push({value:e,added:n,removed:r})},extractCommon:function(t,e,n,r){for(var o=e.length,i=n.length,s=t.newPos,a=s-r;o>s+1&&i>a+1&&this.equals(e[s+1],n[a+1]);)s++,a++,this.pushComponent(t.components,e[s],void 0,void 0);return t.newPos=s,a},equals:function(t,e){var n=/\S/;return!this.ignoreWhitespace||n.test(t)||n.test(e)?t===e:!0},join:function(t,e){return t+e},tokenize:function(t){return t}};var o=new r,i=new r(!0),s=new r;i.tokenize=s.tokenize=function(t){return e(t.split(/(\s+|\b)/))};var a=new r(!0);a.tokenize=function(t){return e(t.split(/([{}:;,]|\s+)/))};var u=new r;return u.tokenize=function(t){for(var e=[],n=t.split(/^/m),r=0;r<n.length;r++){var o=n[r],i=n[r-1];"\n"==o&&i&&"\r"===i[i.length-1]?e[e.length-1]+="\n":o&&e.push(o)}return e},{Diff:r,diffChars:function(t,e){return o.diff(t,e)},diffWords:function(t,e){return i.diff(t,e)},diffWordsWithSpace:function(t,e){return s.diff(t,e)},diffLines:function(t,e){return u.diff(t,e)},diffCss:function(t,e){return a.diff(t,e)},createPatch:function(t,e,n,r,o){function i(t){return t.map(function(t){return" "+t})}function s(t,e,n){var r=c[c.length-2],o=e===c.length-2,i=e===c.length-3&&(n.added!==r.added||n.removed!==r.removed);/\n$/.test(n.value)||!o&&!i||t.push("\\ No newline at end of file")}var a=[];a.push("Index: "+t),a.push("==================================================================="),a.push("--- "+t+("undefined"==typeof r?"":" "+r)),a.push("+++ "+t+("undefined"==typeof o?"":" "+o));var c=u.diff(e,n);c[c.length-1].value||c.pop(),c.push({value:"",lines:[]});for(var l=0,f=0,p=[],h=1,d=1,g=0;g<c.length;g++){var m=c[g],v=m.lines||m.value.replace(/\n$/,"").split("\n");if(m.lines=v,m.added||m.removed){if(!l){var y=c[g-1];l=h,f=d,y&&(p=i(y.lines.slice(-4)),l-=p.length,f-=p.length)}p.push.apply(p,v.map(function(t){return(m.added?"+":"-")+t})),s(p,g,m),m.added?d+=v.length:h+=v.length}else{if(l)if(v.length<=8&&g<c.length-2)p.push.apply(p,i(v));else{var w=Math.min(v.length,4);a.push("@@ -"+l+","+(h-l+w)+" +"+f+","+(d-f+w)+" @@"),a.push.apply(a,p),a.push.apply(a,i(v.slice(0,w))),v.length<=4&&s(a,g,m),l
l+='<a name="'+n+'"></a>\n',l+=e(t.title)+"\n"}),t.on("suite end",function(){--c}),t.on("pass",function(t){var e=s.clean(t.fn.toString());l+=t.title+".\n",l+="\n```js\n",l+=e+"\n",l+="```\n\n"}),t.on("end",function(){i.stdout.write("# TOC\n"),i.stdout.write(u(t.suite)),i.stdout.write(l)})}var o=n("./base"),s=n("../utils"),a="$";e=t.exports=r}),t.register("reporters/min.js",function(t,e,n){function r(t){s.call(this,t),t.on("start",function(){i.stdout.write(""),i.stdout.write("")}),t.on("end",this.epilogue.bind(this))}function o(){}var s=n("./base");e=t.exports=r,o.prototype=s.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("reporters/nyan.js",function(t,e,n){function r(t){a.call(this,t);{var e=this,n=(this.stats,.75*a.window.width|0),r=(this.rainbowColors=e.generateColors(),this.colorIndex=0,this.numberOfLines=4,this.trajectories=[[],[],[],[]],this.nyanCatWidth=11);this.trajectoryWidthMax=n-r,this.scoreboardWidth=5,this.tick=0}t.on("start",function(){a.cursor.hide(),e.draw()}),t.on("pending",function(){e.draw()}),t.on("pass",function(){e.draw()}),t.on("fail",function(){e.draw()}),t.on("end",function(){a.cursor.show();for(var t=0;t<e.numberOfLines;t++)o("\n");e.epilogue()})}function o(t){i.stdout.write(t)}function s(){}var a=n("./base");e=t.exports=r,r.prototype.draw=function(){this.appendRainbow(),this.drawScoreboard(),this.drawRainbow(),this.drawNyanCat(),this.tick=!this.tick},r.prototype.drawScoreboard=function(){function t(t,e){o(" "),o(a.color(t,e)),o("\n")}var e=this.stats;t("green",e.passes),t("fail",e.failures),t("pending",e.pending),o("\n"),this.cursorUp(this.numberOfLines)},r.prototype.appendRainbow=function(){for(var t=this.tick?"_":"-",e=this.rainbowify(t),n=0;n<this.numberOfLines;n++){var r=this.trajectories[n];r.length>=this.trajectoryWidthMax&&r.shift(),r.push(e)}},r.prototype.drawRainbow=function(){var t=this;this.trajectories.forEach(function(e){o("["+t.scoreboardWidth+"C"),o(e.join("")),o("\n")}),this.cursorUp(this.numberOfLines)},r.prototype.drawNyanCat=function(){var t=this,e=this.scoreboardWidth+this.trajectories[0].length,n="["+e+"C",r="";o(n),o("_,------,"),o("\n"),o(n),r=t.tick?" ":" ",o("_|"+r+"/\\_/\\ "),o("\n"),o(n),r=t.tick?"_":"__";var i=t.tick?"~":"^";o(i+"|"+r+this.face()+" "),o("\n"),o(n),r=t.tick?" ":" ",o(r+'"" "" '),o("\n"),this.cursorUp(this.numberOfLines)},r.prototype.face=function(){var t=this.stats;return t.failures?"( x .x)":t.pending?"( o .o)":t.passes?"( ^ .^)":"( - .-)"},r.prototype.cursorUp=function(t){o("["+t+"A")},r.prototype.cursorDown=function(t){o("["+t+"B")},r.prototype.generateColors=function(){for(var t=[],e=0;42>e;e++){var n=Math.floor(Math.PI/3),r=e*(1/6),o=Math.floor(3*Math.sin(r)+3),i=Math.floor(3*Math.sin(r+2*n)+3),s=Math.floor(3*Math.sin(r+4*n)+3);t.push(36*o+6*i+s+16)}return t},r.prototype.rainbowify=function(t){if(!a.useColors)return t;var e=this.rainbowColors[this.colorIndex%this.rainbowColors.length];return this.colorIndex+=1,"[38;5;"+e+"m"+t+""},s.prototype=a.prototype,r.prototype=new s,r.prototype.constructor=r}),t.register("reporters/progress.js",function(t,e,n){function r(t,e){s.call(this,t);var n=this,e=e||{},r=(this.stats,.5*s.window.width|0),o=t.total,c=0,l=(Math.max,-1);e.open=e.open||"[",e.complete=e.complete||"▬",e.incomplete=e.incomplete||s.symbols.dot,e.close=e.close||"]",e.verbose=!1,t.on("start",function(){console.log(),a.hide()}),t.on("test end",function(){c++;var t=c/o,n=r*t|0,s=r-n;(l!==n||e.verbose)&&(l=n,a.CR(),i.stdout.write(""),i.stdout.write(u("progress"," "+e.open)),i.stdout.write(Array(n).join(e.complete)),i.stdout.write(Array(s).join(e.incomplete)),i.stdout.write(u("progress",e.close)),e.verbose&&i.stdout.write(u("progress"," "+c+" of "+o)))}),t.on("end",function(){a.show(),console.log(),n.epilogue()})}function o(){}var s=n("./base"),a=s.cursor,u=s.color;e=t.exports=r,s.colors.progress=90,o.prototype=s.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("reporters/spec.js",function(t,e,n){function r(t){function e(){return Array(r).join(" ")}i.call(this,t);var n=this,r=(thi