Closed niallo closed 9 years ago
Any feedback on this PR? Would love to see it upstream!
Ping
Checked it & love it ;) As written in one of the other PRs, I have to do some build script fixes first, but then it will land in 0.0.9
Finally found some time to get this in, sorry for the delay & thanks for the contribution :)
This PR implements Mocha-style optional async support in beforeEach and afterEach functions. This is extremely useful for per-test setup and teardown functions which need to perform IO. For example, creating test users or other data in order for the test to work.
If you don't accept a parameter in your each() function, synchronous semantics are provided - so it's 100% backwards compatible with existing Dalek tests. If your each functions accept a single argument, then async semantics are expected and you can call the callback when you are done.
Here is an example to show what it looks like:
Want the existing synchronous style? Doesn't require any changes: