When using a 3rd party library I often find an optional parameter in the callback.
For example, in Mocha when the callback done parameter exists, it waits for done to be invoked before moving on to another test case.
someFunction(function(done) { /** code **/ })
someFunction(function() { /** this behaves differently than above **/ })
How can I achieve the same behavior?