JavaScript unit testing framework!!!
Keep it simple.
function test (name, fn) {
console.group(name);
fn(function () { console.assert.apply(console, arguments); });
console.groupEnd();
}
// Usage
test("My test", function (assert) {
assert(true, "Everything ok!");
});Written by Jacob Rask
Related protips
1 Response
Better wrap that function call with a try/catch, or else you'll end up with a console.group that never ends!
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Javascript
Authors
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#