utility2 (2020.5.31)
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"; var testCaseDict; testCaseDict = {}; 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 */ // hack-jslint window.utility2.nop(opt); onError(new Error("this is a failed error demo")); }; testCaseDict.testCase_passed_ajax_demo = function (opt, onError) { /* * this function will demo a passed ajax test */ var data; opt = {url: "/"}; // test ajax-req for main-page "/" window.utility2.ajax(opt, function (err, xhr) { try { // handle err console.assert(!err, err); // validate "200 ok" status console.assert(xhr.statusCode === 200, xhr.statusCode); // validate non-empty data data = xhr.responseText; console.assert(data && data.length > 0, data); onError(); } catch (errCaught) { onError(errCaught); } }); }; window.utility2.testRunDefault(testCaseDict); }());
jslint autofix
instrumented-code
stderr and stdout
[ this app was created with
utility2
]