Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more data to promise matchers #490

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

harelmo
Copy link
Contributor

@harelmo harelmo commented Aug 11, 2022

What

When using toReject / toResolve, print more detailed failure reason (e.g. when toResolve gets a rejected promise, the rejection value will be printed for easier troubleshooting (as discussed in #322 and #218)

Why

Often when refactoring code tested using toResolve or toReject, the test fails but it's unclear on why since the resolved or rejection values are not displayed as a part of the test-failure outout.
This PR adds:

  1. The rejection value when toResolve receives a rejected promise
  2. The resolved value when .not.toResolve receives a resolved promise
  3. The resolved value when toReject receives a resolved promise
  4. The reject value when .not.toReject receives a rejected promise.

Notes

This does not change the beahvior of toResolve or toReject in any way, but only adds extra info on falitures.

Housekeeping

  • Unit tests
  • Documentation is up to date
  • No additional lint warnings
  • Typescript definitions are added/updated where relevant

@harelmo
Copy link
Contributor Author

harelmo commented Aug 11, 2022

I'm not sure why did the coverage drop, the message helpers I've added are still tested by the existing tests... can anyone assist please?

@harelmo
Copy link
Contributor Author

harelmo commented Aug 31, 2022

@SimenB any chance you can take a look? 🙏 I'd really appreciate it

@SimenB
Copy link
Member

SimenB commented Feb 18, 2023

@harelmo I like these changes! could you rebase and fix CI?

…ise-matchers

# Conflicts:
#	src/matchers/toReject.js
#	src/matchers/toResolve.js
@changeset-bot
Copy link

changeset-bot bot commented Mar 14, 2023

⚠️ No Changeset found

Latest commit: 0ed0bf9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@keeganwitt
Copy link
Collaborator

Merged main into this branch and updated the snapshots. It's now failing for coverage reasons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants