Preserve order of nested asynchronous teardowns #223

evanp opened this Issue Jul 27, 2012 · 3 comments


None yet

2 participants


The teardown for a context should only fire after the teardown of its contained contexts have finished.

I use teardowns for testing persistence code. The outer context makes the database connection and its teardown disconnects; inner contexts create temporary database structures and their teardowns delete the structures.

(And, yes, I'm aware that it's possible to just leave those structures in place, or what have you. But I think that good unit tests clean up after themselves.)

We've got good support for letting sub-contexts finish most of their work before teardowns happen; let's finish the job.


Here's example code that shows the problem:

vowsjs member

I think this is a duplicate of #179, but I like your example better. Will leave this open and close #179.

@indexzero indexzero added v1.0.0 and removed v0.9.0 labels Nov 22, 2014
@indexzero indexzero added a commit that referenced this issue Nov 22, 2014
@indexzero indexzero [fix] Perform teardowns using `async.forEachSeries` with a non-config…
…urable `2000ms` timeout. Fixes #223.
vowsjs member

@evanp thought about this a bit more as I fixed it and it is most definitely a breaking change. Fix was committed in 1242b19, and we are just about to release v0.9.x so this should be coming soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment