What do you use to test Cof开发者_如何学JAVAeeScript in the browser and in the server (node.js)?
Thanks
I use QUnit to test my CoffeeScript code in both a browser and via commandline; you can use node-qunit to test on the server. There are other solutions out there, but QUnit fits my needs pretty well and can be quite elegantly utilized from CoffeeScript:
module 'MyModule'
test 'MyModule.someFunction', ->
ok someValue
strictEqual anotherValue, 323
QUnit, additionally, has support for asynchronous tests, which makes it suitable not only for testing AJAX in the browser but also for testing various asynchronous fixtures in node.js like I/O.
I use jasmine in both the browser and in node.js (via jasmine-node). I also like the jasmine-jquery plugin. Jasmine has some async support built it as well. The jasmine syntax is very nice in CoffeeScript whereas its a little verbose in javascript with so many nested functions.
精彩评论