Skip to content

Instantly share code, notes, and snippets.

@cpsubrian
Created November 20, 2011 21:54
Show Gist options
  • Save cpsubrian/1380993 to your computer and use it in GitHub Desktop.
Save cpsubrian/1380993 to your computer and use it in GitHub Desktop.
Getting spawn to work
###
The following is in a Cakefile and when I run it it causes errors.
However, if I just run: `vows test/*.coffee --spec` on the command line, all is fine.
###
{spawn} = require 'child_process'
task 'test', 'Run Vows tests', ->
args = ['test/*.coffee', '--spec']
options = {cwd: __dirname}
spec = spawn 'vows', args, options
spec.stdout.on 'data', (data) -> print data.toString()
spec.stderr.on 'data', (data) -> print data.toString()
spec.on 'exit', (status) -> callback?() if status is 0
$ cake test
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module '/home/cpsubrian/projects/node/coffee-dox/test/*'
at Function._resolveFilename (module.js:317:11)
at Function._load (module.js:262:25)
at require (module.js:346:19)
at /home/cpsubrian/.nvm/v0.4.11/lib/node_modules/vows/bin/vows:466:19
at Array.reduce (native)
at importSuites (/home/cpsubrian/.nvm/v0.4.11/lib/node_modules/vows/bin/vows:461:18)
at Object.<anonymous> (/home/cpsubrian/.nvm/v0.4.11/lib/node_modules/vows/bin/vows:240:15)
at Module._compile (module.js:402:26)
at Object..js (module.js:408:10)
at Module.load (module.js:334:31)
$ vows test/*.coffee
····················································································· ······
✓ OK » 91 honored (0.142s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment