Fix for onTestComplete

Fix for #116. The onTestComplete callback can return undefined, a boolean or a promise.

Also added error checking and reporting for #123