jest-community / jest-extended

Additional Jest matchers 🃏💪
https://jest-extended.jestcommunity.dev/
MIT License
2.33k stars 225 forks source link

Output rejected / resolved value when matcher failed #322

Open rluvaton opened 3 years ago

rluvaton commented 3 years ago

Feature request:

When using .toResolve or .toReject and the promise doesn't settle as we expected we see the error:

Expected promise to resolve but rejected instead

(This error is not the exact error that outputted but it goes something like that)

But when a promise resolved/rejected when it shouldn't it would be helpful to output the promise result so we can now why it rejected/resolved

So maybe the new error message will be something like:

Expected promise to resolve but rejected instead with value:

I can create a PR for this if wanted

ChristianSchwarz commented 3 years ago

I can create a PR for this if wanted That would be a great improvment!