Write unit tests in Coffeescript that resemble tests written with Ruby's Test::Unit. You can use it with node or in the browser.
Janitor lets you write unit tests in Coffeescript that resemble tests written with Ruby's Test::Unit. You can use it with node or in the browser.
@complete()in each of your synchronous tests.
Get the most recent dist file and include it on your test page. Define your tests like so:
'test mood': ->user = mood: 'happy'@assert userisHappy
Then, run your tests like this:
runner = el: documentgetElementById'js_test_results'runnerrun
Test results will now be outputted to the #js_test_results element.
Add the following to your
Cakefile (read more about Cakefiles).
task 'test''Run test suite'->Janitor = require 'janitor'runner = dir: __dirname + '/test'runnerrun
cake test to see test results in the terminal.
MyLib = require '../.'module.exports =: ->@obj ='test something': ->@assert @objallIsWell'test something': ->@assert @objeverythingOk
You can also test asynchronously by using
async test prefix instead of
module.exports ='async test something': ->obj =objdoSomething =>@assert objallIsWell@complete