testit/dist/testit.min.js.map

8 lines
2.9 KiB
Plaintext
Raw Normal View History

2021-01-02 08:42:41 +00:00
{
"version": 3,
"sources": ["../src/testit.js"],
2023-03-15 13:54:36 +00:00
"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,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": ["test", "errors", "next", "tests", "failed", "passed", "name", "err", "expression", "msg", "testit_default"]
2021-01-02 08:42:41 +00:00
}