Skip to content

Instantly share code, notes, and snippets.

@loveencounterflow
Created May 7, 2013 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loveencounterflow/5536720 to your computer and use it in GitHub Desktop.
Save loveencounterflow/5536720 to your computer and use it in GitHub Desktop.
**testing for interaction between longjohn, coffeenode-stacktrace, q, process.on 'uncaughtException' and coa**. test 1 runs as expected; event handler is called, longjohn optionally delivers long stacktrace, so q should be fine. but in test_2 (when called as ``coffee test-stacktrace f``), although longjohn manages to deliver long stacktrace, eve…
# require 'coffeenode-stacktrace'
# require 'longjohn'
log = console.log
fs = require 'fs'
Q = require 'q'
coa = require 'coa' # https://github.com/veged/coa
process.on 'uncaughtException', ( error ) =>
log '### ERROR ###'
test_1 = ->
promise = Q.nfcall fs.readFile, './package.json'
promise = promise.then -> Q.nfcall fs.readFile, './XXXXXX'
promise.done()
test_2 = ->
f = ->
log '### f ###'
d.x # `d` doesn't exist
cmd = coa.Cmd()
scmd = cmd.cmd()
scmd = scmd.name 'f'
scmd = scmd.helpful()
scmd = scmd.act f
cmd = scmd.end()
cmd.run process.argv.slice 2
# test_1()
test_2()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment