Preserve order of nested asynchronous teardowns #223

Open
evanp opened this Issue Jul 27, 2012 · 3 comments

Projects

None yet

2 participants

@evanp

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.

@evanp

Here's example code that shows the problem:

https://gist.github.com/3188646

@indexzero
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.
1242b19
@indexzero
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