Last Updated: February 25, 2016
·
771
· 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 ·