[ospec] record errors thrown in tests as failures

This commit is contained in:
Pierre-Yves Gérardy 2018-06-01 13:42:14 +02:00 committed by Pierre-Yves Gérardy
parent 53597871b8
commit a23216b987
2 changed files with 32 additions and 6 deletions

View file

@ -179,12 +179,18 @@ else window.o = m()
startTimer()
}
} else {
var p = fn()
if (p && p.then) {
startTimer()
p.then(function() { done() }, done)
} else {
nextTickish(next)
try{
var p = fn()
if (p && p.then) {
startTimer()
p.then(function() { done() }, done)
} else {
nextTickish(next)
}
} catch (e) {
if (task.err != null) finalizeAsync(e)
// The errors of internal tasks (which don't have an Err) are ospec bugs and must be rethrown.
else throw e
}
}
globalTimeout = noTimeoutRightNow