Closed aiham closed 7 years ago
I would submit a fix but I don't know how you want to update your custom test framework to also take into account the expected Promise result type.
Thanks for your report. Sorry that I mistook how finally works.
try {
try {
throw 'err'
} finally {
console.log('ok')
}
} catch (e) {
console.log(e)
}
I thought the console.log(e)
won't be executed, but I'm wrong. It's not catch
. I'll fix it as soon as possible.
v0.18.1 published. If there's any problem, I will reopen this issue.
@ysmood Thanks for the quick response!
If I call
finally
on a rejected promise it unexpectedly becomes fulfilled.With yaku:
With bluebird:
Your
finally
test doesn't catch this because although you expect'error'
here: https://github.com/ysmood/yaku/blob/master/test/finally.js#L28You do not confirm that its a rejection here: https://github.com/ysmood/yaku/blob/master/test/testSuit.js#L14
The cause is that you do not rethrow or wrap
value
withPromise.reject
here: https://github.com/ysmood/yaku/blob/b5187ec39a90befed234ad27c980d7a36744ef49/src/yaku.js#L154