Extensible JavaScript test suite module
API (1.7)
- id: identifier or name for the test (defaults to a positive integer)
- test: result or callback (called in testObject's scope)
- pass: message or callback (default: "Pass")
- fail: message or callback (default: "Fail")
- handler: defaults to
aok.prototype.handler
- express: defaults to
aok.prototype.express
- explain: defaults to
aok.prototype.explain
- run: defaults to
aok.prototype.run
- cull: defaults to
aok.prototype.cull
- init: defaults to
aok.prototype.init
aok({
id: 'example'
, test: function() {
return 'example' === this.id;
}
});
aok(typeof aok == 'function');
aok(aok instanceof aok);
aok(function() {
return isFinite(this.id);
});
aok.log(message)
aok.info(message)
aok.warn(message)
aok.error(message)
aok.assert(expression, message)
1.6+aok.trace()
aok.clear()
1.7+
aok.can(fn)
Get a new function that usestry
/catch
to test if fn can run.aok.explain(item?)
Represent item (or self) as a string.aok.perform(trials, fn)
Test how many milliseconds it takes for fn to run trials times.aok.race(trials, rivals)
Test how many milliseconds it takes each rival to run trials times.aok.pass(stack, test, scope?, limit?)
Iterate stack to count passes until limit.aok.fail(stack, test, scope?, limit?)
Iterate stack to count fails untillimit
.aok.result(object, key|fn)
Getobject[key]
or its method's result if callable.
License: MIT
Copyright (C) 2013 by Ryan Van Etten