Last Updated: February 25, 2016
·
949
· jacobrask

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!");
});

1 Response
Add your 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
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