Cleanup async before/it sections #3

Closed
twolfson opened this Issue Mar 24, 2013 · 3 comments

Projects

None yet

1 participant

@twolfson
Owner

These got really sloppy due to a time crunch. Please revisit/clean them.

@twolfson
Owner

One possible route is to move it/bfore to different methods as well as move to an EventEmitter style syntax.

This would work very well for code cleanliness and is great since it and before are global. I am just curious about if the scope chain will stay intact.

@twolfson
Owner

This might only apply to before as it should receive the flattened description in a single function. However, mocha supports multiple before statements which will be run in the order they are specified. That would clean up the before logic significantly.

before(function () {
  // a
});

before(function (done) {
  // b
  done();
});

before(function () {
  // c
});

TODO: Verify that it will work even if one of them is async (pretty sure it will).

@twolfson
Owner

Released in 2.5.0

@twolfson twolfson closed this Jun 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment