From 049b1ba3229f99b555b89075377c1acea5f90356 Mon Sep 17 00:00:00 2001 From: Geoff Doty Date: Mon, 2 Apr 2018 04:36:52 -0400 Subject: [PATCH] added minified version --- src/testit.min.js | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 src/testit.min.js diff --git a/src/testit.min.js b/src/testit.min.js new file mode 100644 index 0000000..b927a7c --- /dev/null +++ b/src/testit.min.js @@ -0,0 +1,2 @@ +/* Test.it v 0.5.1 | MIT | https://github.com/n2geoff/testit */ +;(function(root,factory){if(typeof module==="object"&&module.exports){module.exports=factory(root.test)}else{root.test=factory(root.test)}})(this,function(){"use strict";const test={_tests:{},run:function(next){let tests=this._tests;let failed=[];let passed=[];Object.keys(tests).forEach(function(name){let test=tests[name];try{test();passed.push(`\n+ ${name}`)}catch(err){failed.push(`\n- ${name}`);console.error(err)}});if(typeof next==="function"){return next({pass:passed,fail:failed})}else{console.log(...passed,...failed);console.log(`\n# tests ${failed.length+passed.length} pass ${passed.length} fail ${failed.length}`);return failed.length?false:true}},it:function(tests){this._tests=tests;return this},assert:function(e,a){if(e!=a)throw Error(`expected ${e} == ${a}`)},equals:function(e,a){if(e!==a)throw Error(`expected ${e} === ${a}`)},exists:function(v){if(!v)throw Error(`exists value ${v}`)},pass:function(){return true},fail:function(m){throw Error(m)}};return test});