This method is used inside addAssertion to create a promise from the given body function.
When the promise body takes no arguments, the body will be executed. If the body throws an exception a rejected promise will be returned. If the body returns a promise that will be returned by the method; otherwise a resolve promise will be returned. You can use the method the following way:
When the promise body takes one argument it will be executed and given a wrapper function that should be used to wrap asynchronous callbacks:
If an exception is throw from within the
run-wrapper the created
promise will be rejected with the error.
Notice you can call the run wrapper as many times as you want as long as it is within the current tick, the promise will wait for all the wrapper functions to finish before the promise will be rejected or fulfilled.
When the promise body takes two arguments, it is just an alias for: