Closed everett1992 closed 2 months ago
While working on https://github.com/tschaub/mock-fs/blob/main/changelog.md#400 I noticed that tests would timeout when some assertions failed because done was never called.
promise.then(() => { assert(false) done() }, done)
The issue is that then will only call one of it's two callbacks. The onRejected function is not called when onFulfilled throws an error.
then
Switching to .catch(done) guarnatees the a rejected promise chain marks the test as completed.
.catch(done)
Thank you, @everett1992. This was a long-standing oversight!
While working on https://github.com/tschaub/mock-fs/blob/main/changelog.md#400 I noticed that tests would timeout when some assertions failed because done was never called.
The issue is that
then
will only call one of it's two callbacks. The onRejected function is not called when onFulfilled throws an error.Switching to
.catch(done)
guarnatees the a rejected promise chain marks the test as completed.