mirror of https://github.com/n2geoff/testit.git
deps
This commit is contained in:
parent
0112677df5
commit
ac5626cd25
34
.eslintrc.js
34
.eslintrc.js
|
@ -1,34 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
"env": {
|
|
||||||
"browser": true,
|
|
||||||
"es6": true,
|
|
||||||
"node": true
|
|
||||||
},
|
|
||||||
"extends": "eslint:recommended",
|
|
||||||
"globals": {
|
|
||||||
"Atomics": "readonly",
|
|
||||||
"SharedArrayBuffer": "readonly"
|
|
||||||
},
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 2018,
|
|
||||||
"sourceType": "module"
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"no-console": [
|
|
||||||
"warn"
|
|
||||||
],
|
|
||||||
"indent": [
|
|
||||||
"error",
|
|
||||||
4,
|
|
||||||
{"SwitchCase": 1}
|
|
||||||
],
|
|
||||||
"quotes": [
|
|
||||||
"error",
|
|
||||||
"double"
|
|
||||||
],
|
|
||||||
"semi": [
|
|
||||||
"error",
|
|
||||||
"always"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"es2021": true
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"overrides": [
|
||||||
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": "latest",
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
}
|
||||||
|
}
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
The MIT License
|
The MIT License
|
||||||
|
|
||||||
Copyright (c) 2021 Geoff Doty
|
Copyright (c) 2023 Geoff Doty
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/*! Test.it v1.0.0 | MIT | https://github.com/n2geoff/testit */const i={log:console.log,version:"v1.0.0",_tests:{},run:function(t,n){typeof t!="boolean"&&(n=t,t=!0);let r=this._tests||[],e=[],s=[];return Object.keys(r).forEach(l=>{let h=r[l];try{h(),s.push(`
|
/*! Test.it v1.1.2 | MIT | https://github.com/n2geoff/testit */const i={log:console.log,version:"v1.1.2",_tests:{},run:function(t,n){typeof t!="boolean"&&(n=t,t=!0);let r=this._tests||[],e=[],s=[];return Object.keys(r).forEach(l=>{let h=r[l];try{h(),s.push(`
|
||||||
+OK ${l}`)}catch(f){t?e.push(`
|
+OK ${l}`)}catch(f){t?e.push(`
|
||||||
-ERR ${l}
|
-ERR ${l}
|
||||||
---
|
---
|
||||||
${f.stack}
|
${f.stack}
|
||||||
---`):e.push(`
|
---`):e.push(`
|
||||||
-ERR ${l}`)}}),typeof n=="function"?n({pass:s,fail:e}):(i.log(...s,...e),i.log(`
|
-ERR ${l}`)}}),typeof n=="function"?n({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:(o,t)=>{try{if(!o)throw new Error(t||"Assertion Failed")}catch(n){throw new Error(t)}}};var u=i;export{u as default};
|
# tests ${e.length+s.length} pass ${s.length} fail ${e.length}`),!e.length)},it:function(t){return this._tests=t,this},assert:(o,t)=>{try{if(!o)throw new Error(t||"Assertion Failed")}catch{throw new Error(t)}}};var u=i;export{u as default};
|
||||||
//# sourceMappingURL=testit.min.js.map
|
//# sourceMappingURL=testit.min.js.map
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"version": 3,
|
"version": 3,
|
||||||
"sources": ["../src/testit.js"],
|
"sources": ["../src/testit.js"],
|
||||||
"sourcesContent": ["/*! Test.it v1.0.0 | MIT | https://github.com/n2geoff/testit */\r\nconst test = {\r\n \"log\": console.log, // eslint-disable-line\r\n \"version\": \"v1.0.0\",\r\n \"_tests\": {},\r\n \"run\": function run(errors, next) {\r\n // TODO: rewrite to allow a show errors flag (optional)\r\n if(typeof errors !== \"boolean\") {\r\n next = errors;\r\n errors = true;\r\n }\r\n\r\n let tests = this._tests || [];\r\n // capture results\r\n let failed = [];\r\n let passed = [];\r\n\r\n // loop through tests\r\n Object.keys(tests).forEach((name) => {\r\n let test = tests[name];\r\n\r\n // execute\r\n try {\r\n test();\r\n passed.push(`\\n+OK ${name}`);\r\n } catch (err) {\r\n if (errors) {\r\n failed.push(`\\n-ERR ${name} \\n --- \\n ${err.stack} \\n ---`);\r\n } else {\r\n failed.push(`\\n-ERR ${name}`);\r\n }\r\n }\r\n });\r\n\r\n // summary\r\n if(typeof next === \"function\") {\r\n return next({\r\n pass: passed,\r\n fail: failed\r\n });\r\n } else {\r\n test.log(...passed, ...failed);\r\n test.log(`\\n# tests ${failed.length + passed.length} pass ${passed.length} fail ${failed.length}`);\r\n\r\n return failed.length ? false : true;\r\n }\r\n },\r\n \"it\": function it(tests) {\r\n this._tests = tests;\r\n return this;\r\n },\r\n \"assert\": (expression, msg) => {\r\n try {\r\n if(!expression) {\r\n throw new Error(msg || \"Assertion Failed\");\r\n }\r\n } catch (e) {\r\n throw new Error(msg);\r\n }\r\n }\r\n};\r\n\r\nexport default test;\r\n"],
|
"sourcesContent": ["/*! Test.it v1.1.2 | MIT | https://github.com/n2geoff/testit */\r\nconst test = {\r\n \"log\": console.log, // eslint-disable-line\r\n \"version\": \"v1.1.2\",\r\n \"_tests\": {},\r\n \"run\": function run(errors, next) {\r\n // TODO: rewrite to allow a show errors flag (optional)\r\n if(typeof errors !== \"boolean\") {\r\n next = errors;\r\n errors = true;\r\n }\r\n\r\n let tests = this._tests || [];\r\n // capture results\r\n let failed = [];\r\n let passed = [];\r\n\r\n // loop through tests\r\n Object.keys(tests).forEach((name) => {\r\n let test = tests[name];\r\n\r\n // execute\r\n try {\r\n test();\r\n passed.push(`\\n+OK ${name}`);\r\n } catch (err) {\r\n if (errors) {\r\n failed.push(`\\n-ERR ${name} \\n --- \\n ${err.stack} \\n ---`);\r\n } else {\r\n failed.push(`\\n-ERR ${name}`);\r\n }\r\n }\r\n });\r\n\r\n // summary\r\n if(typeof next === \"function\") {\r\n return next({\r\n pass: passed,\r\n fail: failed\r\n });\r\n } else {\r\n test.log(...passed, ...failed);\r\n test.log(`\\n# tests ${failed.length + passed.length} pass ${passed.length} fail ${failed.length}`);\r\n\r\n return failed.length ? false : true;\r\n }\r\n },\r\n \"it\": function it(tests) {\r\n this._tests = tests;\r\n return this;\r\n },\r\n \"assert\": (expression, msg) => {\r\n try {\r\n if(!expression) {\r\n throw new Error(msg || \"Assertion Failed\");\r\n }\r\n } catch (e) {\r\n throw new Error(msg);\r\n }\r\n }\r\n};\r\n\r\nexport default test;\r\n"],
|
||||||
"mappings": "AAAA,+DACA,MAAM,EAAO,CACT,IAAO,QAAQ,IACf,QAAW,SACX,OAAU,GACV,IAAO,cAEH,AAAG,MAAO,IAAW,WACjB,GAAO,EACP,EAAS,IAGb,MAAY,KAAK,QAAU,KAEd,KACA,GAoBb,MAjBA,QAAO,KAAK,GAAO,QAAQ,IACvB,MAAW,EAAM,GAGjB,IACI,IACA,EAAO,KAAK;AAAA,MAAS,cAErB,AAAI,EACA,EAAO,KAAK;AAAA,OAAU;AAAA;AAAA,GAAkB,EAAI;AAAA,OAE5C,EAAO,KAAK;AAAA,OAAU,QAM/B,MAAO,IAAS,WACR,EAAK,CACR,KAAM,EACN,KAAM,IAGV,GAAK,IAAI,GAAG,EAAQ,GAAG,GACvB,EAAK,IAAI;AAAA,UAAa,EAAO,OAAS,EAAO,eAAe,EAAO,eAAe,EAAO,UAElF,GAAO,SAGtB,GAAM,YACF,YAAK,OAAS,EACP,MAEX,OAAU,QACN,IACI,GAAG,CAAC,EACA,KAAM,IAAI,OAAM,GAAO,6BAG3B,KAAM,IAAI,OAAM,MAK5B,MAAe",
|
"mappings": "AAAA,+DACA,MAAMA,EAAO,CACT,IAAO,QAAQ,IACf,QAAW,SACX,OAAU,CAAC,EACX,IAAO,SAAaC,EAAQC,EAAM,CAE3B,OAAOD,GAAW,YACjBC,EAAOD,EACPA,EAAS,IAGb,IAAIE,EAAQ,KAAK,QAAU,CAAC,EAExBC,EAAS,CAAC,EACVC,EAAS,CAAC,EAoBd,OAjBA,OAAO,KAAKF,CAAK,EAAE,QAASG,GAAS,CACjC,IAAIN,EAAOG,EAAMG,CAAI,EAGrB,GAAI,CACAN,EAAK,EACLK,EAAO,KAAK;AAAA,MAASC,GAAM,CAC/B,OAASC,EAAP,CACMN,EACAG,EAAO,KAAK;AAAA,OAAUE;AAAA;AAAA,GAAkBC,EAAI;AAAA,KAAc,EAE1DH,EAAO,KAAK;AAAA,OAAUE,GAAM,CAEpC,CACJ,CAAC,EAGE,OAAOJ,GAAS,WACRA,EAAK,CACR,KAAMG,EACN,KAAMD,CACV,CAAC,GAEDJ,EAAK,IAAI,GAAGK,EAAQ,GAAGD,CAAM,EAC7BJ,EAAK,IAAI;AAAA,UAAaI,EAAO,OAASC,EAAO,eAAeA,EAAO,eAAeD,EAAO,QAAQ,EAE1F,CAAAA,EAAO,OAEtB,EACA,GAAM,SAAYD,EAAO,CACrB,YAAK,OAASA,EACP,IACX,EACA,OAAU,CAACK,EAAYC,IAAQ,CAC3B,GAAI,CACA,GAAG,CAACD,EACA,MAAM,IAAI,MAAMC,GAAO,kBAAkB,CAEjD,MAAE,CACE,MAAM,IAAI,MAAMA,CAAG,CACvB,CACJ,CACJ,EAEA,IAAOC,EAAQV",
|
||||||
"names": []
|
"names": ["test", "errors", "next", "tests", "failed", "passed", "name", "err", "expression", "msg", "testit_default"]
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -13,7 +13,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^8.20.0"
|
"eslint": "^8.36.0"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*! Test.it v1.0.0 | MIT | https://github.com/n2geoff/testit */
|
/*! Test.it v1.1.2 | MIT | https://github.com/n2geoff/testit */
|
||||||
const test = {
|
const test = {
|
||||||
"log": console.log, // eslint-disable-line
|
"log": console.log, // eslint-disable-line
|
||||||
"version": "v1.0.0",
|
"version": "v1.1.2",
|
||||||
"_tests": {},
|
"_tests": {},
|
||||||
"run": function run(errors, next) {
|
"run": function run(errors, next) {
|
||||||
// TODO: rewrite to allow a show errors flag (optional)
|
// TODO: rewrite to allow a show errors flag (optional)
|
||||||
|
|
Loading…
Reference in New Issue