Comparing version 0.2.3 to 0.2.4
# How to compile | ||
```bash | ||
awk 'FNR==1{print ""}1' src/*.coffee src/package-start.txt package.json src/package-end.txt | node_modules/coffee-script/bin/coffee -cs > wishlist.js && node_modules/uglify-js/bin/uglifyjs wishlist.js -o wishlist.min.js -m --screw-ie8 --comments && awk 'FNR==1{print ""}1' test/*.coffee | node_modules/coffee-script/bin/coffee -cs > test/compiled.js && awk 'FNR==1{print ""}1' integration-test/*.coffee | node_modules/coffee-script/bin/coffee -cs > integration-test/compiled.js | ||
npm install && awk 'FNR==1{print ""}1' src/*.coffee src/package-start.txt package.json src/package-end.txt | node_modules/coffee-script/bin/coffee -cs > wishlist.js && node_modules/uglify-js/bin/uglifyjs wishlist.js -o wishlist.min.js -m --screw-ie8 --comments && awk 'FNR==1{print ""}1' test/*.coffee | node_modules/coffee-script/bin/coffee -cs > test/compiled.js && awk 'FNR==1{print ""}1' integration-test/*.coffee | node_modules/coffee-script/bin/coffee -cs > integration-test/compiled.js | ||
``` | ||
@@ -6,0 +6,0 @@ |
{ | ||
"name": "wishlist", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "Super natural testing framework.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -668,3 +668,3 @@ // Generated by CoffeeScript 1.7.1 | ||
if ((typeof exports !== "undefined" && exports !== null) && ((typeof module !== "undefined" && module !== null ? module.exports : void 0) != null)) { | ||
domain = require("domain").create(); | ||
domain = module.require("domain").create(); | ||
domain.on("error", function(error) { | ||
@@ -1127,3 +1127,3 @@ return _this.end({ | ||
"name": "wishlist", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "Super natural testing framework.", | ||
@@ -1130,0 +1130,0 @@ "keywords": ["test", "testing", "async", "unit", "bdd", "tdd", "asynchronous", "mocha", "qunit", "karma", "jasmine", "vows", "qunitjs", "chai"], |
@@ -7,2 +7,2 @@ /* @preserve | ||
*/ | ||
(function(){var npmWishlist,__indexOf=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++){if(t in this&&this[t]===e)return t}return-1};npmWishlist={};npmWishlist.environmentType=typeof exports!=="undefined"&&exports!==null&&(typeof module!=="undefined"&&module!==null?module.exports:void 0)!=null?"node":typeof window!=="undefined"&&window!==null?"browser":void 0;npmWishlist.objectIs=function(e,t){if(typeof e==="number"&&typeof t==="number"){if(e===0&&t===0){return 1/e===1/t}else if(isNaN(e)&&isNaN(t)){return true}else{return e===t}}else{return e===t}};npmWishlist.objectClone=function(e){var t,n,s,r,i;n={};i=Object.keys(e);for(s=0,r=i.length;s<r;s++){t=i[s];n[t]=e[t]}return n};npmWishlist.valueToMessage=function(e){var t,n;t=function(e,n){if(e===void 0){return"undefined"}else if(e===null){return"null"}else if(Array.isArray(e)){if(n>0){return"["+e.map(function(e){return t(e,n-1)}).join(",")+"]"}else{return"[Array]"}}else if(typeof e==="function"){return"[Function]"}else if(typeof e==="object"){if(n>0){return"{"+Object.keys(e).map(function(s){return""+JSON.stringify(s)+":"+t(e[s],n-1)}).join(",")+"}"}else{return"[Object]"}}else if(typeof e==="string"){return JSON.stringify(e.toString())}else if(typeof e==="number"){if(npmWishlist.objectIs(e,-0)){return"-0"}else{return e.toString()}}else{return e.toString()}};n=t(e,3);if(n.length>1e3){n=t(e,2)}if(n.length>1e3){n=t(e,1)}if(n.length>1e3){n=t(e,0)}return n};npmWishlist.parseExpression=function(e,t){var n,s,r,i,l,u,o,a,f,p,c,h,m,y;e+=" ";if(t.length===0){return[]}c=new RegExp("^("+t.join("|")+")[^a-zA-Z0-9_$]","g");f=[];p=null;m=true;y=false;s=false;i=false;r=0;while(r<e.length-1){n=e[r];o=m;if(p===null){if("a"<=n&&n<="z"||"A"<=n&&n<="Z"||"0"<=n&&n<="9"||n==="_"||n==="$"||n===")"||n==="]"){m=false}else if(n===" "||n===" "||n==="\n"||n==="\r"){}else{m=true}}a=y;if(p===null){if("a"<=n&&n<="z"||"A"<=n&&n<="Z"||"0"<=n&&n<="9"||n==="_"||n==="$"||n==="."){y=true}else{y=false}}l=s;if(p===null){if(n==="."){s=true}else if(n===" "||n===" "||n==="\n"||n==="\r"){}else{s=false}}u=i;if(p===null){if(n==="{"||n===","){i=true}else if(n===" "||n===" "||n==="\n"||n==="\r"){}else{i=false}}if(n==='"'&&p===null){p="double";r++}else if(n==="'"&&p===null){p="single";r++}else if(n==="/"&&p===null&&o){p="slash";r++}else if(n==='"'&&p==="double"||n==="'"&&p==="single"||n==="/"&&p==="slash"){p=null;r++}else if(n==="\\"&&p!==null){r+=2}else if(p===null&&!a&&!l&&("a"<=n&&n<="z"||"A"<=n&&n<="Z")){h=e.substr(r,31);if(!(u&&h.search(/^([a-zA-Z0-9_$])+\s*:/)!==-1)&&h.search(c)!==-1){f.push(r)}r++}else{r++}}return f};npmWishlist.parseWish=function(e){var t,n;n=null;t=null;[0,1].forEach(function(s){var r,i,l,u,o,a,f,p,c,h,m,y;h=null;c=0;i=0;r=0;y=true;u=false;o=0;while(o<e.length){l=e[o];p=y;if(h===null){if("a"<=l&&l<="z"||"A"<=l&&l<="Z"||"0"<=l&&l<="9"||l==="_"||l==="$"||l===")"||l==="]"){y=false}else if(l===" "||l===" "||l==="\n"||l==="\r"){}else{y=true}}f=u;if(h===null){if(l==="."){u=true}else if(l===" "||l===" "||l==="\n"||l==="\r"){}else{u=false}}if(l==='"'&&h===null){h="double";o++}else if(l==="'"&&h===null){h="single";o++}else if(l==="/"&&h===null&&p){h="slash";o++}else if(l==='"'&&h==="double"||l==="'"&&h==="single"||l==="/"&&h==="slash"){h=null;o++}else if(l==="\\"&&h!==null){o+=2}else if(l==="("){c++;o++}else if(l==="["){i++;o++}else if(l==="{"){r++;o++}else if(l===")"){c--;o++}else if(l==="]"){i--;o++}else if(l==="}"){r--;o++}else if(h===null&&!f&&(c===i&&i===r&&r===0)){if(s===0){if(l===":"){t=e.substr(o+1);e=e.substr(0,o);break}}else if(s===1){m=e.substr(o);if((a=m.match(/^=([^]+)$/))!=null){n={type:"equal",components:[e.substr(0,o),a[1]]};break}else if((a=m.match(/^<>([^]+)$/))!=null){n={type:"notEqual",components:[e.substr(0,o),a[1]]};break}else if((a=m.match(/^\sis\s([^]+)$/))!=null){n={type:"is",components:[e.substr(0,o),a[1]]};break}else if((a=m.match(/^\sisnt\s([^]+)$/))!=null){n={type:"isnt",components:[e.substr(0,o),a[1]]};break}else if((a=m.match(/^\sthrows(?:\s([^]+))?$/))!=null){n={type:"throws",components:[e.substr(0,o),a[1]!=null?a[1]:"undefined"]};break}else if((a=m.match(/^<=([^]+)$/))!=null){n={type:"lessThanOrEqual",components:[e.substr(0,o),a[1]]};break}else if((a=m.match(/^>=([^]+)$/))!=null){n={type:"greaterThanOrEqual",components:[e.substr(0,o),a[1]]};break}else if((a=m.match(/^<([^]+)$/))!=null){n={type:"lessThan",components:[e.substr(0,o),a[1]]};break}else if((a=m.match(/^>([^]+)$/))!=null){n={type:"greaterThan",components:[e.substr(0,o),a[1]]};break}}o++}else{o++}}if(s===1){return n!=null?n:n={type:"doesNotThrow",components:[e]}}});n.components.push(JSON.stringify((t!=null?t:e).trim()));return n};npmWishlist.parseWishes=function(e){var t,n,s,r,i,l,u,o,a,f,p,c;a=null;u=0;n=0;t=0;c=true;o=[];r=0;while(r<e.length){s=e[r];l=c;if(a===null){if("a"<=s&&s<="z"||"A"<=s&&s<="Z"||"0"<=s&&s<="9"||s==="_"||s==="$"||s===")"||s==="]"){c=false}else if(s===" "||s===" "||s==="\n"||s==="\r"){}else{c=true}}if(s==='"'&&a===null){a="double";r++}else if(s==="'"&&a===null){a="single";r++}else if(s==="/"&&a===null&&l){a="slash";r++}else if(s==='"'&&a==="double"||s==="'"&&a==="single"||s==="/"&&a==="slash"){a=null;r++}else if(s==="\\"&&a!==null){r+=2}else if(s==="("){u++;r++}else if(s==="["){n++;r++}else if(s==="{"){t++;r++}else if(s===")"){u--;r++}else if(s==="]"){n--;r++}else if(s==="}"){t--;r++}else if(a===null&&(u===n&&n===t&&t===0)&&s===";"){o.push(r);r++}else{r++}}f=[];i=-1;o.forEach(function(t){var n;n=e.substring(i+1,t).trim();if(n!==""){f.push(n)}return i=t});p=e.substr(i+1).trim();if(p!==""){f.push(p)}return f};npmWishlist.sha256=function(e){var t,n,s,r,i,l,u,o,a,f,p,c,h,m,y,g,d,v,b,W,T,w,_,x,j,k,A,E,M,O,z,S,I,$,N,q,C,Z,R,J;if(e.length>Math.round(Math.pow(2,31)-1)){throw new Error}I=function(e){var t;return function(){var n,s;s=[];for(t=n=7;n>=0;t=--n){s.push(((e>>>t*4)%16).toString(16))}return s}().join("")};y=function(){var e,t,n,s;t=0;for(n=0,s=arguments.length;n<s;n++){e=arguments[n];t=(t+e)%4294967296}return t};u=function(e,t){return e>>>t|e<<32-t};o=function(e,t){return e>>>t};t=function(e,t,n){return e&t^~e&n};i=function(e,t,n){return e&t^e&n^t&n};a=function(e){return u(e,2)^u(e,13)^u(e,22)};f=function(e){return u(e,6)^u(e,11)^u(e,25)};O=function(e){return u(e,7)^u(e,18)^o(e,3)};z=function(e){return u(e,17)^u(e,19)^o(e,10)};s=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];n=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];d=e.split("").map(function(e){return e.charCodeAt(0)});A=e.length*8;k=448-A-1;while(k<0){k+=512}M=A+1+k+64;d.push(128);for(x=$=0,J=Math.round((k-7)/8);0<=J?$<J:$>J;x=0<=J?++$:--$){d.push(0)}d.push(0);d.push(0);d.push(0);d.push(0);d.push(A>>>24);d.push((A>>>16)%256);d.push((A>>>8)%256);d.push(A%256);l=Math.round(M/512);r=new Array(l);for(x=N=0;0<=l?N<l:N>l;x=0<=l?++N:--N){r[x]=new Array(16);for(j=q=0;q<16;j=++q){E=x*64+j*4;r[x][j]=d[E]<<24|d[E+1]<<16|d[E+2]<<8|d[E+3]}}h=new Array(64);for(x=C=0;0<=l?C<l:C>l;x=0<=l?++C:--C){for(S=Z=0;Z<64;S=++Z){h[S]=S<16?r[x][S]:y(z(h[S-2]),h[S-7],O(h[S-15]),h[S-16])}m=n[0];g=n[1];v=n[2];b=n[3];W=n[4];T=n[5];w=n[6];_=n[7];for(S=R=0;R<64;S=++R){p=y(_,f(W),t(W,T,w),s[S],h[S]);c=y(a(m),i(m,g,v));_=w;w=T;T=W;W=y(b,p);b=v;v=g;g=m;m=y(p,c)}n[0]=y(m,n[0]);n[1]=y(g,n[1]);n[2]=y(v,n[2]);n[3]=y(b,n[3]);n[4]=y(W,n[4]);n[5]=y(T,n[5]);n[6]=y(w,n[6]);n[7]=y(_,n[7])}return n.map(function(e){return I(e)}).join("")};npmWishlist.Test=function(){function Test(e){this.description=e!=null?e:"";this._children=[];this.fun=function(e){return function(){}}(this);this.wishes=[];this.async=false;this.parent=null;this._resetContext()}Test.prototype._resetContext=function(){this.env={};this.wishResults=[];return this.result=null};Test.prototype.set=function(){var e,t,n,s,r,i;e=t=i=r=s=void 0;n=function(e){return function(e){var t;t=Array.isArray(e)?e.join(";"):typeof e==="string"?e:"";return npmWishlist.parseWishes(t)}}(this);if(typeof arguments[0]==="string"){e=arguments[0];t=arguments[1];if(typeof arguments[2]==="object"&&arguments[2]!==null&&!Array.isArray(arguments[2])){s=arguments[2]}else{r=arguments[2];s=arguments[3]}}else{t=arguments[0];if(typeof arguments[1]==="object"&&arguments[1]!==null&&!Array.isArray(arguments[1])){s=arguments[1]}else{r=arguments[1];s=arguments[2]}}i=n(r);if(s==null){s={}}if(e!==void 0){this.description=e}this.fun=t;if(r!==void 0){this.wishes=i}if(s.async!==void 0){this.async=s.async}return this};Test.prototype.setAsync=function(){var e,t,n,s,r;e=[];for(s=0,r=arguments.length;s<r;s++){n=arguments[s];e.push(n)}t=e[e.length-1];if(typeof t==="object"&&t!==null&&!Array.isArray(t)){t.async=true}else{e.push({async:true})}return this.set.apply(this,e)};Test.prototype.add=function(){var e;e=null;if(arguments[0]instanceof npmWishlist.Test){e=arguments[0]}else{e=new npmWishlist.Test;e.set.apply(e,arguments)}e.parent=this;this._children.push(e);return this};Test.prototype.addAsync=function(){var e,t,n,s,r;e=[];for(s=0,r=arguments.length;s<r;s++){n=arguments[s];e.push(n)}t=e[e.length-1];if(typeof t==="object"&&t!==null&&!Array.isArray(t)){t.async=true}else{e.push({async:true})}return this.add.apply(this,e)};Test.prototype.getChildren=function(){return this._children.slice(0)};Test.prototype.getAncestors=function(){var e,t;t=this;e=[];while(t.parent!==null){e.push(t.parent);t=t.parent}return e};Test.prototype.run=function(e){var t,n,s,r;if(e==null){e=true}this._resetContext();if(this.parent!=null){this.env=npmWishlist.objectClone(this.parent.env)}setTimeout(function(e){return function(){var t;if(typeof exports!=="undefined"&&exports!==null&&(typeof module!=="undefined"&&module!==null?module.exports:void 0)!=null){t=require("domain").create();t.on("error",function(t){return e.end({type:false,errorMessage:"Error Name: "+t.name+"\nError Message: "+t.message+"\nError Stack: "+t.stack})});t.run(function(){return e.fun(e.env,e)})}else{try{e.fun(e.env,e)}catch(t){e.end({type:false})}}if(e.result==null&&!e.async){return e.end({type:true})}}}(this),0);if(e){t=[];t.push(this);r=function(e){return function(e){return e.getChildren().forEach(function(e){t.push(e);return r(e)})}}(this);r(this);console.log();s=function(e){return function(){var e,s,r,i,l,u,o;l=t.filter(function(e){return e.result!=null&&e.result.type===true});e=t.filter(function(e){return e.result!=null&&e.result.type===false});u=t.filter(function(e){return e.result==null});console.log(""+(new Date).toISOString()+" OK: "+l.length+", "+("Exception: "+e.length+", Pending: "+u.length));if(u.length===0){clearInterval(n);e.forEach(function(e){console.log("\n********** Exceptional Test **********");console.log("Test: "+e.description);console.log("Function: "+e.fun.toString());if(e.result.errorMessage!=null){return console.log(e.result.errorMessage)}});s=0;o=0;i="";t.forEach(function(e){return e.wishResults.forEach(function(t){var n,r;i+=" "+t.type.toString();if(t.type===false){s++;n=e.getAncestors();n.reverse();r=n.concat([e]).map(function(e){return e.description}).join(" --> ");console.log("\n********** Broken Wish **********");console.log(" Test: "+r);console.log(" Wish: "+t.description);console.log("Expected: "+t.expected);return console.log(" Actual: "+t.actual)}else{return o++}})});i=i.trim();r=npmWishlist.sha256(i).substr(0,5);console.log("\n"+((e.length===0?"Tests OK.":""+e.length+" tests of "+t.length+" exceptional.")+" "+(s===0?"Wishes fulfilled.":""+s+" wishes of "+(s+o)+" broken.")+" "+("Mark: "+r))+"\n");if(typeof process!=="undefined"&&process!==null){return process.exit()}}}}(this);n=setInterval(s,1e3);setTimeout(s,10)}return this};Test.prototype.end=function(e){if(this.result==null){this.result=e!=null?e:{type:true};this.wishes.forEach(function(e){return function(t){return e._checkWish(t)}}(this));this.getChildren().forEach(function(e){return function(e){return e.run(false)}}(this))}return this};Test.prototype._checkWish=function(wishStr){var args,description,interpret,parsed,result,that;that=this;interpret=function(e){return function(t){npmWishlist.parseExpression(t,Object.keys(e.env)).forEach(function(e,n){var s,r;s="that.env.";r=e+s.length*n;return t=t.substr(0,r)+s+t.substr(r)});return t}}(this);parsed=npmWishlist.parseWish(wishStr);args=parsed.components.map(function(e){return function(e,t){if(t===parsed.components.length-1){return e}else{return interpret(e)}}}(this));description=JSON.parse(args[args.length-1]);result=function(){try{args=args.map(function(_this){return function(m){return eval("(("+m+"))")}}(this));return this["_check_"+parsed.type].apply(this,args)}catch(e){return{type:false,description:description,actual:"unknown",expected:"unknown"}}}.call(this);return this.wishResults.push(result)};Test.prototype.wish=function(e){return npmWishlist.parseWishes(e).forEach(function(e){return function(t){return e._checkWish(t)}}(this))};return Test}();npmWishlist.Test.prototype._check_equal=function(e,t,n){var s,r,i;if(n==null){n=""}r=[];s=function(e){return function(e,t){if(Array.isArray(e)&&Array.isArray(t)){if(t.every(function(t,n){if(__indexOf.call(r,t)>=0){return npmWishlist.objectIs(e[n],t)}else{if(typeof t==="object"&&t!==null){r.push(t)}return s(e[n],t)}})){return true}else{return false}}else if(typeof e==="object"&&e!==null&&typeof t==="object"&&t!==null){if(Object.keys(t).every(function(n){var i;if(i=t[n],__indexOf.call(r,i)>=0){return npmWishlist.objectIs(e[n],t[n])}else{if(typeof t[n]==="object"&&t[n]!==null){r.push(t[n])}return s(e[n],t[n])}})){return true}else{return false}}else{return npmWishlist.objectIs(e,t)}}}(this);i={type:s(e,t),description:n};if(i.type===false){i.actual=npmWishlist.valueToMessage(e);i.expected="= "+npmWishlist.valueToMessage(t)}return i};npmWishlist.Test.prototype._check_notEqual=function(e,t,n){var s,r,i;if(n==null){n=""}r=[];s=function(e){return function(e,t){if(Array.isArray(e)&&Array.isArray(t)){if(t.some(function(t,n){if(__indexOf.call(r,t)>=0){return!npmWishlist.objectIs(e[n],t)}else{if(typeof t==="object"&&t!==null){r.push(t)}return s(e[n],t)}})){return true}else{return false}}else if(typeof e==="object"&&e!==null&&typeof t==="object"&&t!==null){if(Object.keys(t).some(function(n){var i;if(i=t[n],__indexOf.call(r,i)>=0){return!npmWishlist.objectIs(e[n],t[n])}else{if(typeof t[n]==="object"&&t[n]!==null){r.push(t[n])}return s(e[n],t[n])}})){return true}else{return false}}else{return!npmWishlist.objectIs(e,t)}}}(this);i={type:s(e,t),description:n};if(i.type===false){i.actual=npmWishlist.valueToMessage(e);i.expected="≠ "+npmWishlist.valueToMessage(t)}return i};npmWishlist.Test.prototype._check_is=function(e,t,n){var s;if(n==null){n=""}s={type:npmWishlist.objectIs(e,t),description:n};if(s.type===false){s.actual=npmWishlist.valueToMessage(e);s.expected="is "+npmWishlist.valueToMessage(t)}return s};npmWishlist.Test.prototype._check_isnt=function(e,t,n){var s;if(n==null){n=""}s={type:!npmWishlist.objectIs(e,t),description:n};if(s.type===false){s.actual=npmWishlist.valueToMessage(e);s.expected="isn't "+npmWishlist.valueToMessage(t)}return s};npmWishlist.Test.prototype._check_throws=function(e,t,n){var s,r,i,l;if(n==null){n=""}r=false;l=function(){try{e();r=true;return false}catch(e){s=e;if(t==null){return true}else if(t instanceof RegExp){if(t.test(s.message)){return true}else{return false}}else{if(s instanceof t){return true}else{return false}}}}();i={type:l,description:n};if(i.type===false){i.actual=r?"no exception":"another exception";i.expected=r?"exception":"an exception"}return i};npmWishlist.Test.prototype._check_doesNotThrow=function(e,t){var n,s;if(t==null){t=""}s=function(){try{e();return true}catch(e){return false}}();n={type:s,description:t};if(n.type===false){n.actual="exception";n.expected="no exception"}return n};npmWishlist.Test.prototype._check_lessThan=function(e,t,n){var s;if(n==null){n=""}s={type:e<t,description:n};if(s.type===false){s.actual=npmWishlist.valueToMessage(e);s.expected="< "+npmWishlist.valueToMessage(t)}return s};npmWishlist.Test.prototype._check_lessThanOrEqual=function(e,t,n){var s;if(n==null){n=""}s={type:e<=t,description:n};if(s.type===false){s.actual=npmWishlist.valueToMessage(e);s.expected="<= "+npmWishlist.valueToMessage(t)}return s};npmWishlist.Test.prototype._check_greaterThan=function(e,t,n){var s;if(n==null){n=""}s={type:e>t,description:n};if(s.type===false){s.actual=npmWishlist.valueToMessage(e);s.expected="> "+npmWishlist.valueToMessage(t)}return s};npmWishlist.Test.prototype._check_greaterThanOrEqual=function(e,t,n){var s;if(n==null){n=""}s={type:e>=t,description:n};if(s.type===false){s.actual=npmWishlist.valueToMessage(e);s.expected=">= "+npmWishlist.valueToMessage(t)}return s};if(npmWishlist.environmentType==="browser"){window.npmWishlist=npmWishlist}else if(npmWishlist.environmentType==="node"){module.exports=npmWishlist}else{throw new Error}npmWishlist.packageInfo={name:"wishlist",version:"0.2.3",description:"Super natural testing framework.",keywords:["test","testing","async","unit","bdd","tdd","asynchronous","mocha","qunit","karma","jasmine","vows","qunitjs","chai"],author:"Zhenzhen Zhan <zhanzhenzhen@hotmail.com>",homepage:"http://zhanzhenzhen.github.io/wishlist/",licenses:[{type:"MIT",url:"https://github.com/zhanzhenzhen/wishlist/blob/master/LICENSE.txt"}],repository:{type:"git",url:"https://github.com/zhanzhenzhen/wishlist.git"},devDependencies:{"coffee-script":"1.7.1","uglify-js":"2.4.13"},main:"wishlist"}}).call(this); | ||
(function(){var npmWishlist,__indexOf=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++){if(t in this&&this[t]===e)return t}return-1};npmWishlist={};npmWishlist.environmentType=typeof exports!=="undefined"&&exports!==null&&(typeof module!=="undefined"&&module!==null?module.exports:void 0)!=null?"node":typeof window!=="undefined"&&window!==null?"browser":void 0;npmWishlist.objectIs=function(e,t){if(typeof e==="number"&&typeof t==="number"){if(e===0&&t===0){return 1/e===1/t}else if(isNaN(e)&&isNaN(t)){return true}else{return e===t}}else{return e===t}};npmWishlist.objectClone=function(e){var t,n,s,r,i;n={};i=Object.keys(e);for(s=0,r=i.length;s<r;s++){t=i[s];n[t]=e[t]}return n};npmWishlist.valueToMessage=function(e){var t,n;t=function(e,n){if(e===void 0){return"undefined"}else if(e===null){return"null"}else if(Array.isArray(e)){if(n>0){return"["+e.map(function(e){return t(e,n-1)}).join(",")+"]"}else{return"[Array]"}}else if(typeof e==="function"){return"[Function]"}else if(typeof e==="object"){if(n>0){return"{"+Object.keys(e).map(function(s){return""+JSON.stringify(s)+":"+t(e[s],n-1)}).join(",")+"}"}else{return"[Object]"}}else if(typeof e==="string"){return JSON.stringify(e.toString())}else if(typeof e==="number"){if(npmWishlist.objectIs(e,-0)){return"-0"}else{return e.toString()}}else{return e.toString()}};n=t(e,3);if(n.length>1e3){n=t(e,2)}if(n.length>1e3){n=t(e,1)}if(n.length>1e3){n=t(e,0)}return n};npmWishlist.parseExpression=function(e,t){var n,s,r,i,l,u,o,a,f,p,c,h,m,y;e+=" ";if(t.length===0){return[]}c=new RegExp("^("+t.join("|")+")[^a-zA-Z0-9_$]","g");f=[];p=null;m=true;y=false;s=false;i=false;r=0;while(r<e.length-1){n=e[r];o=m;if(p===null){if("a"<=n&&n<="z"||"A"<=n&&n<="Z"||"0"<=n&&n<="9"||n==="_"||n==="$"||n===")"||n==="]"){m=false}else if(n===" "||n===" "||n==="\n"||n==="\r"){}else{m=true}}a=y;if(p===null){if("a"<=n&&n<="z"||"A"<=n&&n<="Z"||"0"<=n&&n<="9"||n==="_"||n==="$"||n==="."){y=true}else{y=false}}l=s;if(p===null){if(n==="."){s=true}else if(n===" "||n===" "||n==="\n"||n==="\r"){}else{s=false}}u=i;if(p===null){if(n==="{"||n===","){i=true}else if(n===" "||n===" "||n==="\n"||n==="\r"){}else{i=false}}if(n==='"'&&p===null){p="double";r++}else if(n==="'"&&p===null){p="single";r++}else if(n==="/"&&p===null&&o){p="slash";r++}else if(n==='"'&&p==="double"||n==="'"&&p==="single"||n==="/"&&p==="slash"){p=null;r++}else if(n==="\\"&&p!==null){r+=2}else if(p===null&&!a&&!l&&("a"<=n&&n<="z"||"A"<=n&&n<="Z")){h=e.substr(r,31);if(!(u&&h.search(/^([a-zA-Z0-9_$])+\s*:/)!==-1)&&h.search(c)!==-1){f.push(r)}r++}else{r++}}return f};npmWishlist.parseWish=function(e){var t,n;n=null;t=null;[0,1].forEach(function(s){var r,i,l,u,o,a,f,p,c,h,m,y;h=null;c=0;i=0;r=0;y=true;u=false;o=0;while(o<e.length){l=e[o];p=y;if(h===null){if("a"<=l&&l<="z"||"A"<=l&&l<="Z"||"0"<=l&&l<="9"||l==="_"||l==="$"||l===")"||l==="]"){y=false}else if(l===" "||l===" "||l==="\n"||l==="\r"){}else{y=true}}f=u;if(h===null){if(l==="."){u=true}else if(l===" "||l===" "||l==="\n"||l==="\r"){}else{u=false}}if(l==='"'&&h===null){h="double";o++}else if(l==="'"&&h===null){h="single";o++}else if(l==="/"&&h===null&&p){h="slash";o++}else if(l==='"'&&h==="double"||l==="'"&&h==="single"||l==="/"&&h==="slash"){h=null;o++}else if(l==="\\"&&h!==null){o+=2}else if(l==="("){c++;o++}else if(l==="["){i++;o++}else if(l==="{"){r++;o++}else if(l===")"){c--;o++}else if(l==="]"){i--;o++}else if(l==="}"){r--;o++}else if(h===null&&!f&&(c===i&&i===r&&r===0)){if(s===0){if(l===":"){t=e.substr(o+1);e=e.substr(0,o);break}}else if(s===1){m=e.substr(o);if((a=m.match(/^=([^]+)$/))!=null){n={type:"equal",components:[e.substr(0,o),a[1]]};break}else if((a=m.match(/^<>([^]+)$/))!=null){n={type:"notEqual",components:[e.substr(0,o),a[1]]};break}else if((a=m.match(/^\sis\s([^]+)$/))!=null){n={type:"is",components:[e.substr(0,o),a[1]]};break}else if((a=m.match(/^\sisnt\s([^]+)$/))!=null){n={type:"isnt",components:[e.substr(0,o),a[1]]};break}else if((a=m.match(/^\sthrows(?:\s([^]+))?$/))!=null){n={type:"throws",components:[e.substr(0,o),a[1]!=null?a[1]:"undefined"]};break}else if((a=m.match(/^<=([^]+)$/))!=null){n={type:"lessThanOrEqual",components:[e.substr(0,o),a[1]]};break}else if((a=m.match(/^>=([^]+)$/))!=null){n={type:"greaterThanOrEqual",components:[e.substr(0,o),a[1]]};break}else if((a=m.match(/^<([^]+)$/))!=null){n={type:"lessThan",components:[e.substr(0,o),a[1]]};break}else if((a=m.match(/^>([^]+)$/))!=null){n={type:"greaterThan",components:[e.substr(0,o),a[1]]};break}}o++}else{o++}}if(s===1){return n!=null?n:n={type:"doesNotThrow",components:[e]}}});n.components.push(JSON.stringify((t!=null?t:e).trim()));return n};npmWishlist.parseWishes=function(e){var t,n,s,r,i,l,u,o,a,f,p,c;a=null;u=0;n=0;t=0;c=true;o=[];r=0;while(r<e.length){s=e[r];l=c;if(a===null){if("a"<=s&&s<="z"||"A"<=s&&s<="Z"||"0"<=s&&s<="9"||s==="_"||s==="$"||s===")"||s==="]"){c=false}else if(s===" "||s===" "||s==="\n"||s==="\r"){}else{c=true}}if(s==='"'&&a===null){a="double";r++}else if(s==="'"&&a===null){a="single";r++}else if(s==="/"&&a===null&&l){a="slash";r++}else if(s==='"'&&a==="double"||s==="'"&&a==="single"||s==="/"&&a==="slash"){a=null;r++}else if(s==="\\"&&a!==null){r+=2}else if(s==="("){u++;r++}else if(s==="["){n++;r++}else if(s==="{"){t++;r++}else if(s===")"){u--;r++}else if(s==="]"){n--;r++}else if(s==="}"){t--;r++}else if(a===null&&(u===n&&n===t&&t===0)&&s===";"){o.push(r);r++}else{r++}}f=[];i=-1;o.forEach(function(t){var n;n=e.substring(i+1,t).trim();if(n!==""){f.push(n)}return i=t});p=e.substr(i+1).trim();if(p!==""){f.push(p)}return f};npmWishlist.sha256=function(e){var t,n,s,r,i,l,u,o,a,f,p,c,h,m,y,g,d,v,b,W,T,w,_,x,j,k,A,E,M,O,z,S,I,$,N,q,C,Z,R,J;if(e.length>Math.round(Math.pow(2,31)-1)){throw new Error}I=function(e){var t;return function(){var n,s;s=[];for(t=n=7;n>=0;t=--n){s.push(((e>>>t*4)%16).toString(16))}return s}().join("")};y=function(){var e,t,n,s;t=0;for(n=0,s=arguments.length;n<s;n++){e=arguments[n];t=(t+e)%4294967296}return t};u=function(e,t){return e>>>t|e<<32-t};o=function(e,t){return e>>>t};t=function(e,t,n){return e&t^~e&n};i=function(e,t,n){return e&t^e&n^t&n};a=function(e){return u(e,2)^u(e,13)^u(e,22)};f=function(e){return u(e,6)^u(e,11)^u(e,25)};O=function(e){return u(e,7)^u(e,18)^o(e,3)};z=function(e){return u(e,17)^u(e,19)^o(e,10)};s=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];n=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];d=e.split("").map(function(e){return e.charCodeAt(0)});A=e.length*8;k=448-A-1;while(k<0){k+=512}M=A+1+k+64;d.push(128);for(x=$=0,J=Math.round((k-7)/8);0<=J?$<J:$>J;x=0<=J?++$:--$){d.push(0)}d.push(0);d.push(0);d.push(0);d.push(0);d.push(A>>>24);d.push((A>>>16)%256);d.push((A>>>8)%256);d.push(A%256);l=Math.round(M/512);r=new Array(l);for(x=N=0;0<=l?N<l:N>l;x=0<=l?++N:--N){r[x]=new Array(16);for(j=q=0;q<16;j=++q){E=x*64+j*4;r[x][j]=d[E]<<24|d[E+1]<<16|d[E+2]<<8|d[E+3]}}h=new Array(64);for(x=C=0;0<=l?C<l:C>l;x=0<=l?++C:--C){for(S=Z=0;Z<64;S=++Z){h[S]=S<16?r[x][S]:y(z(h[S-2]),h[S-7],O(h[S-15]),h[S-16])}m=n[0];g=n[1];v=n[2];b=n[3];W=n[4];T=n[5];w=n[6];_=n[7];for(S=R=0;R<64;S=++R){p=y(_,f(W),t(W,T,w),s[S],h[S]);c=y(a(m),i(m,g,v));_=w;w=T;T=W;W=y(b,p);b=v;v=g;g=m;m=y(p,c)}n[0]=y(m,n[0]);n[1]=y(g,n[1]);n[2]=y(v,n[2]);n[3]=y(b,n[3]);n[4]=y(W,n[4]);n[5]=y(T,n[5]);n[6]=y(w,n[6]);n[7]=y(_,n[7])}return n.map(function(e){return I(e)}).join("")};npmWishlist.Test=function(){function Test(e){this.description=e!=null?e:"";this._children=[];this.fun=function(e){return function(){}}(this);this.wishes=[];this.async=false;this.parent=null;this._resetContext()}Test.prototype._resetContext=function(){this.env={};this.wishResults=[];return this.result=null};Test.prototype.set=function(){var e,t,n,s,r,i;e=t=i=r=s=void 0;n=function(e){return function(e){var t;t=Array.isArray(e)?e.join(";"):typeof e==="string"?e:"";return npmWishlist.parseWishes(t)}}(this);if(typeof arguments[0]==="string"){e=arguments[0];t=arguments[1];if(typeof arguments[2]==="object"&&arguments[2]!==null&&!Array.isArray(arguments[2])){s=arguments[2]}else{r=arguments[2];s=arguments[3]}}else{t=arguments[0];if(typeof arguments[1]==="object"&&arguments[1]!==null&&!Array.isArray(arguments[1])){s=arguments[1]}else{r=arguments[1];s=arguments[2]}}i=n(r);if(s==null){s={}}if(e!==void 0){this.description=e}this.fun=t;if(r!==void 0){this.wishes=i}if(s.async!==void 0){this.async=s.async}return this};Test.prototype.setAsync=function(){var e,t,n,s,r;e=[];for(s=0,r=arguments.length;s<r;s++){n=arguments[s];e.push(n)}t=e[e.length-1];if(typeof t==="object"&&t!==null&&!Array.isArray(t)){t.async=true}else{e.push({async:true})}return this.set.apply(this,e)};Test.prototype.add=function(){var e;e=null;if(arguments[0]instanceof npmWishlist.Test){e=arguments[0]}else{e=new npmWishlist.Test;e.set.apply(e,arguments)}e.parent=this;this._children.push(e);return this};Test.prototype.addAsync=function(){var e,t,n,s,r;e=[];for(s=0,r=arguments.length;s<r;s++){n=arguments[s];e.push(n)}t=e[e.length-1];if(typeof t==="object"&&t!==null&&!Array.isArray(t)){t.async=true}else{e.push({async:true})}return this.add.apply(this,e)};Test.prototype.getChildren=function(){return this._children.slice(0)};Test.prototype.getAncestors=function(){var e,t;t=this;e=[];while(t.parent!==null){e.push(t.parent);t=t.parent}return e};Test.prototype.run=function(e){var t,n,s,r;if(e==null){e=true}this._resetContext();if(this.parent!=null){this.env=npmWishlist.objectClone(this.parent.env)}setTimeout(function(e){return function(){var t;if(typeof exports!=="undefined"&&exports!==null&&(typeof module!=="undefined"&&module!==null?module.exports:void 0)!=null){t=module.require("domain").create();t.on("error",function(t){return e.end({type:false,errorMessage:"Error Name: "+t.name+"\nError Message: "+t.message+"\nError Stack: "+t.stack})});t.run(function(){return e.fun(e.env,e)})}else{try{e.fun(e.env,e)}catch(t){e.end({type:false})}}if(e.result==null&&!e.async){return e.end({type:true})}}}(this),0);if(e){t=[];t.push(this);r=function(e){return function(e){return e.getChildren().forEach(function(e){t.push(e);return r(e)})}}(this);r(this);console.log();s=function(e){return function(){var e,s,r,i,l,u,o;l=t.filter(function(e){return e.result!=null&&e.result.type===true});e=t.filter(function(e){return e.result!=null&&e.result.type===false});u=t.filter(function(e){return e.result==null});console.log(""+(new Date).toISOString()+" OK: "+l.length+", "+("Exception: "+e.length+", Pending: "+u.length));if(u.length===0){clearInterval(n);e.forEach(function(e){console.log("\n********** Exceptional Test **********");console.log("Test: "+e.description);console.log("Function: "+e.fun.toString());if(e.result.errorMessage!=null){return console.log(e.result.errorMessage)}});s=0;o=0;i="";t.forEach(function(e){return e.wishResults.forEach(function(t){var n,r;i+=" "+t.type.toString();if(t.type===false){s++;n=e.getAncestors();n.reverse();r=n.concat([e]).map(function(e){return e.description}).join(" --> ");console.log("\n********** Broken Wish **********");console.log(" Test: "+r);console.log(" Wish: "+t.description);console.log("Expected: "+t.expected);return console.log(" Actual: "+t.actual)}else{return o++}})});i=i.trim();r=npmWishlist.sha256(i).substr(0,5);console.log("\n"+((e.length===0?"Tests OK.":""+e.length+" tests of "+t.length+" exceptional.")+" "+(s===0?"Wishes fulfilled.":""+s+" wishes of "+(s+o)+" broken.")+" "+("Mark: "+r))+"\n");if(typeof process!=="undefined"&&process!==null){return process.exit()}}}}(this);n=setInterval(s,1e3);setTimeout(s,10)}return this};Test.prototype.end=function(e){if(this.result==null){this.result=e!=null?e:{type:true};this.wishes.forEach(function(e){return function(t){return e._checkWish(t)}}(this));this.getChildren().forEach(function(e){return function(e){return e.run(false)}}(this))}return this};Test.prototype._checkWish=function(wishStr){var args,description,interpret,parsed,result,that;that=this;interpret=function(e){return function(t){npmWishlist.parseExpression(t,Object.keys(e.env)).forEach(function(e,n){var s,r;s="that.env.";r=e+s.length*n;return t=t.substr(0,r)+s+t.substr(r)});return t}}(this);parsed=npmWishlist.parseWish(wishStr);args=parsed.components.map(function(e){return function(e,t){if(t===parsed.components.length-1){return e}else{return interpret(e)}}}(this));description=JSON.parse(args[args.length-1]);result=function(){try{args=args.map(function(_this){return function(m){return eval("(("+m+"))")}}(this));return this["_check_"+parsed.type].apply(this,args)}catch(e){return{type:false,description:description,actual:"unknown",expected:"unknown"}}}.call(this);return this.wishResults.push(result)};Test.prototype.wish=function(e){return npmWishlist.parseWishes(e).forEach(function(e){return function(t){return e._checkWish(t)}}(this))};return Test}();npmWishlist.Test.prototype._check_equal=function(e,t,n){var s,r,i;if(n==null){n=""}r=[];s=function(e){return function(e,t){if(Array.isArray(e)&&Array.isArray(t)){if(t.every(function(t,n){if(__indexOf.call(r,t)>=0){return npmWishlist.objectIs(e[n],t)}else{if(typeof t==="object"&&t!==null){r.push(t)}return s(e[n],t)}})){return true}else{return false}}else if(typeof e==="object"&&e!==null&&typeof t==="object"&&t!==null){if(Object.keys(t).every(function(n){var i;if(i=t[n],__indexOf.call(r,i)>=0){return npmWishlist.objectIs(e[n],t[n])}else{if(typeof t[n]==="object"&&t[n]!==null){r.push(t[n])}return s(e[n],t[n])}})){return true}else{return false}}else{return npmWishlist.objectIs(e,t)}}}(this);i={type:s(e,t),description:n};if(i.type===false){i.actual=npmWishlist.valueToMessage(e);i.expected="= "+npmWishlist.valueToMessage(t)}return i};npmWishlist.Test.prototype._check_notEqual=function(e,t,n){var s,r,i;if(n==null){n=""}r=[];s=function(e){return function(e,t){if(Array.isArray(e)&&Array.isArray(t)){if(t.some(function(t,n){if(__indexOf.call(r,t)>=0){return!npmWishlist.objectIs(e[n],t)}else{if(typeof t==="object"&&t!==null){r.push(t)}return s(e[n],t)}})){return true}else{return false}}else if(typeof e==="object"&&e!==null&&typeof t==="object"&&t!==null){if(Object.keys(t).some(function(n){var i;if(i=t[n],__indexOf.call(r,i)>=0){return!npmWishlist.objectIs(e[n],t[n])}else{if(typeof t[n]==="object"&&t[n]!==null){r.push(t[n])}return s(e[n],t[n])}})){return true}else{return false}}else{return!npmWishlist.objectIs(e,t)}}}(this);i={type:s(e,t),description:n};if(i.type===false){i.actual=npmWishlist.valueToMessage(e);i.expected="≠ "+npmWishlist.valueToMessage(t)}return i};npmWishlist.Test.prototype._check_is=function(e,t,n){var s;if(n==null){n=""}s={type:npmWishlist.objectIs(e,t),description:n};if(s.type===false){s.actual=npmWishlist.valueToMessage(e);s.expected="is "+npmWishlist.valueToMessage(t)}return s};npmWishlist.Test.prototype._check_isnt=function(e,t,n){var s;if(n==null){n=""}s={type:!npmWishlist.objectIs(e,t),description:n};if(s.type===false){s.actual=npmWishlist.valueToMessage(e);s.expected="isn't "+npmWishlist.valueToMessage(t)}return s};npmWishlist.Test.prototype._check_throws=function(e,t,n){var s,r,i,l;if(n==null){n=""}r=false;l=function(){try{e();r=true;return false}catch(e){s=e;if(t==null){return true}else if(t instanceof RegExp){if(t.test(s.message)){return true}else{return false}}else{if(s instanceof t){return true}else{return false}}}}();i={type:l,description:n};if(i.type===false){i.actual=r?"no exception":"another exception";i.expected=r?"exception":"an exception"}return i};npmWishlist.Test.prototype._check_doesNotThrow=function(e,t){var n,s;if(t==null){t=""}s=function(){try{e();return true}catch(e){return false}}();n={type:s,description:t};if(n.type===false){n.actual="exception";n.expected="no exception"}return n};npmWishlist.Test.prototype._check_lessThan=function(e,t,n){var s;if(n==null){n=""}s={type:e<t,description:n};if(s.type===false){s.actual=npmWishlist.valueToMessage(e);s.expected="< "+npmWishlist.valueToMessage(t)}return s};npmWishlist.Test.prototype._check_lessThanOrEqual=function(e,t,n){var s;if(n==null){n=""}s={type:e<=t,description:n};if(s.type===false){s.actual=npmWishlist.valueToMessage(e);s.expected="<= "+npmWishlist.valueToMessage(t)}return s};npmWishlist.Test.prototype._check_greaterThan=function(e,t,n){var s;if(n==null){n=""}s={type:e>t,description:n};if(s.type===false){s.actual=npmWishlist.valueToMessage(e);s.expected="> "+npmWishlist.valueToMessage(t)}return s};npmWishlist.Test.prototype._check_greaterThanOrEqual=function(e,t,n){var s;if(n==null){n=""}s={type:e>=t,description:n};if(s.type===false){s.actual=npmWishlist.valueToMessage(e);s.expected=">= "+npmWishlist.valueToMessage(t)}return s};if(npmWishlist.environmentType==="browser"){window.npmWishlist=npmWishlist}else if(npmWishlist.environmentType==="node"){module.exports=npmWishlist}else{throw new Error}npmWishlist.packageInfo={name:"wishlist",version:"0.2.4",description:"Super natural testing framework.",keywords:["test","testing","async","unit","bdd","tdd","asynchronous","mocha","qunit","karma","jasmine","vows","qunitjs","chai"],author:"Zhenzhen Zhan <zhanzhenzhen@hotmail.com>",homepage:"http://zhanzhenzhen.github.io/wishlist/",licenses:[{type:"MIT",url:"https://github.com/zhanzhenzhen/wishlist/blob/master/LICENSE.txt"}],repository:{type:"git",url:"https://github.com/zhanzhenzhen/wishlist.git"},devDependencies:{"coffee-script":"1.7.1","uglify-js":"2.4.13"},main:"wishlist"}}).call(this); |
Sorry, the diff of this file is not supported yet
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
133757
2
0