utility2 (2021.5.1)
this zero-dependency package will provide high-level functions to to build, test, and deploy webapps
download standalone app
run browser-tests
edit or paste script below to cover and test
// remove comment below to disable jslint /*jslint browser, devel*/ /*global window*/ (function () { "use strict"; let local = window.utility2; let testCaseDict = { modeTest: 1 }; // comment this testCase to disable failed error demo testCaseDict.testCase_failed_error_demo = function (opt, onError) { /* * this function will run a failed error demo */ onError(new Error("this is a failed error demo"), opt); }; testCaseDict.testCase_passed_http_fetch_demo = function (opt, onError) { /* * this function will demo a passed http-fetch test */ // fetch main-page "/" window.fetch("/").then(function (res) { // validate "200 ok" status local.assertOrThrow(res.status === 200, res.status); return res.text(); }).then(function (data) { // validate non-empty data local.assertOrThrow(data && data.length > 0, data); onError(undefined, opt); // handle err }).catch(onError); }; // create coverage-report local.eventListenerAdd("utility2.testRunEnd", {}, function () { document.querySelector( "#htmlCoverageReport1" ).innerHTML = local.coverageReportCreate({}); }); // run tests if (!( /npm_config_mode_test=1/ ).test(location.search)) { local.testRunDefault(testCaseDict); } }());
jslint autofix
instrumented-code
stderr and stdout
[ this app was created with
utility2
]