I am writing (more and more) a unit test suite using Coffeescript and node.js. I create files using the "watch" option for coffee (-w)
coffee -w -b -c -o web/ src/
My problem is that running unit tests takes 20 seconds (I assume to compile in .js).
If possible, I would like to automatically run unit tests when changing a file (compiled .js), which will save you a long wait for results.
My current Cakefile:
fs = require 'fs'
{print} = require 'sys'
{spawn, exec} = require 'child_process'
build = (watch, callback) ->
if typeof watch is 'function'
callback = watch
watch = false
options = ['-c', '-b', '-o', 'web', 'src']
options.unshift '-w' if watch
coffee = spawn 'coffee', options
coffee.stdout.on 'data', (data) -> print data.toString()
coffee.stderr.on 'data', (data) -> print data.toString()
coffee.on 'exit', (status) -> callback?() if status is 0
task 'test', 'Run the test suite', ->
build ->
require.paths.unshift __dirname + "/lib"
{reporters} = require 'nodeunit'
process.chdir __dirname
reporters.default.run ['test']
source
share