-
Notifications
You must be signed in to change notification settings - Fork 143
Running Unit Tests written in CoffeeScript
mmanela edited this page Sep 15, 2014
·
4 revisions
Chutzpah supports running unit tests you write in the CoffeeScript language. You need to tell Chutzpah how to compile your files into JavaScript using the compile setting in the chutzpah.json file. There is an example of this for [CoffeeScript in the samples folder|https://github.com/mmanela/chutzpah/tree/master/Samples/Compilation/CoffeeScript].
For example given a CoffeeScript test file that references another CoffeeScript file:
## <reference path="../code/code.coffee" />
test "A basic test", ->
ok true, "this test is fine"
value = "hello"
equal "hello", value, "We expect value to be hello"
Chutzpah will parse that file as well as the referenced code.coffee file and search for matching .js files that your compile step generates. Notice the syntax for referencing other files. For CoffeeScript files Chutzpah uses comments that start with ## to indicate a reference declaration.