Skip to content

Instantly share code, notes, and snippets.

@dhepper
Created January 13, 2012 15:21
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 dhepper/1606943 to your computer and use it in GitHub Desktop.
Save dhepper/1606943 to your computer and use it in GitHub Desktop.
A Vow with asynchronous teardown in CoffeScript
assert = require 'assert'
vows = require 'vows'
tornDown = false
vows.describe('Vows with asynchronous teardowns').addBatch
'Context with long-running teardown':
'is run first': () ->
teardown: () ->
callback = @callback
setTimeout(() ->
tornDown = true
callback()
return
, 1000)
return
.addBatch
'The next batch':
'is not run until the teardown is complete': () ->
assert.ok tornDown
.export module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment