testit/dist/testit.min.js

10 lines
697 B
JavaScript

/*! Test.it v1.1.3 | MIT | https://github.com/n2geoff/testit */const i={log:console.log,version:"v1.1.3",_tests:{},run:function(t,o){typeof t!="boolean"&&(o=t,t=!0);let r=this._tests||[],e=[],s=[];return Object.keys(r).forEach(n=>{let h=r[n];try{h(),s.push(`
+OK ${n}`)}catch(f){t?e.push(`
-ERR ${n}
---
${f.stack}
---`):e.push(`
-ERR ${n}`)}}),typeof o=="function"?o({pass:s,fail:e}):(i.log(...s,...e),i.log(`
# tests ${e.length+s.length} pass ${s.length} fail ${e.length}`),!e.length)},it:function(t){return this._tests=t,this},assert:(l,t)=>{try{if(!l)throw new Error(t||"Assertion Failed")}catch{throw new Error(t)}}};var u=i;export{u as default};
//# sourceMappingURL=testit.min.js.map