testit/dist/testit.min.js.map

8 lines
2.8 KiB
Plaintext
Raw Permalink Normal View History

2021-01-02 08:42:41 +00:00
{
"version": 3,
"sources": ["../src/testit.js"],
2024-06-16 20:04:12 +00:00
"sourcesContent": ["/*! Test.it v1.1.3 | MIT | https://github.com/n2geoff/testit */\nconst test = {\n \"log\": console.log,\n \"version\": \"v1.1.3\",\n \"_tests\": {},\n \"run\": function run(errors, next) {\n // TODO: rewrite to allow a show errors flag (optional)\n if(typeof errors !== \"boolean\") {\n next = errors;\n errors = true;\n }\n\n let tests = this._tests || [];\n // capture results\n let failed = [];\n let passed = [];\n\n // loop through tests\n Object.keys(tests).forEach((name) => {\n let test = tests[name];\n\n // execute\n try {\n test();\n passed.push(`\\n+OK ${name}`);\n } catch (err) {\n if (errors) {\n failed.push(`\\n-ERR ${name} \\n --- \\n ${err.stack} \\n ---`);\n } else {\n failed.push(`\\n-ERR ${name}`);\n }\n }\n });\n\n // summary\n if(typeof next === \"function\") {\n return next({\n pass: passed,\n fail: failed\n });\n } else {\n test.log(...passed, ...failed);\n test.log(`\\n# tests ${failed.length + passed.length} pass ${passed.length} fail ${failed.length}`);\n\n return failed.length ? false : true;\n }\n },\n \"it\": function it(tests) {\n this._tests = tests;\n return this;\n },\n \"assert\": (expression, msg) => {\n try {\n if(!expression) {\n throw new Error(msg || \"Assertion Failed\");\n }\n } catch {\n throw new Error(msg);\n }\n }\n};\n\nexport default test;\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,CAAI,EAAE,CAC/B,OAASC,EAAK,CACNN,EACAG,EAAO,KAAK;AAAA,OAAUE,CAAI;AAAA;AAAA,GAAcC,EAAI,KAAK;AAAA,KAAS,EAE1DH,EAAO,KAAK;AAAA,OAAUE,CAAI,EAAE,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,MAAM,SAASA,EAAO,MAAM,SAASD,EAAO,MAAM,EAAE,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,MAAQ,CACJ,MAAM,IAAI,MAAMA,CAAG,CACvB,CACJ,CACJ,EAEA,IAAOC,EAAQV",
2023-03-15 13:54:36 +00:00
"names": ["test", "errors", "next", "tests", "failed", "passed", "name", "err", "expression", "msg", "testit_default"]
2021-01-02 08:42:41 +00:00
}