Fix unhandled promise rejection in tests#482
Conversation
|
Thanks for contributing, sorry this slipped under my radar and it's been 10 days. I'd be curious to understand "what gives" if the promise remains un-handled? Or said differently, what led you to seeing this issue and what insight/value do we gain from handling it? This is more to be informed in the future, on the base of this i don't see a reason not to approve |
|
Node's default is to emit Event: 'unhandledRejection' and a deprecation warning. The warning mentions It really only matters if the default or CI / test runner settings change. I discovered it in the output of |
|
On second thought, it might look better like this? const rejected = Promise.reject(0)
rejected.catch(() => 'Handle promise rejection, avoid error.')
t.equal(isPromise(Promise.resolve(0)), true, 'returns true when passed a resolved promise')
t.equal(isPromise(rejected), true, 'returns true when passed a rejected promise') |
|
Thanks for the extra context. I am a big fan of the arrange, act, assert structure so i like the second option. That being said, both handle the raised issue. I'm happy to approve as is or your welcome to change. I'll leave it to you |
20a19b0 to
bd23ee4
Compare
|
@evilsoft it appears travis doesn't want to play ball again, Is it because of a force-push? |
|
Would rebasing onto the previous commit help? If this project squashes PR commits by default, may I suggest a note about it (and avoiding force pushes) in CONTRIBUTING? |
|
Oh snap, so sorry I missed this @dalefrancis88 @benhormann GREAT catch on this btw, thanks you so much for your time and effort! |

Found an error message when running the tests.