Support err as first argument for done callbacks in async tests

This commit is contained in:
Stephan Hoyer 2017-08-08 09:07:39 +02:00
parent b345e4f023
commit 39be9134f9
2 changed files with 16 additions and 12 deletions

View file

@ -153,10 +153,14 @@ o.spec("ospec", function() {
var a = 0, b = 0
function wrapPromise(fn) {
return new Promise(resolve => {
return new Promise((resolve, reject) => {
callAsync(() => {
fn()
resolve()
try {
fn()
resolve()
} catch(e) {
reject(e)
}
})
})
}