-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
expect: Improve report when matcher fails, part 17 #8349
Conversation
Negative assertion edge case The cost of edge case for double meaning of Friendly reviewers, your critique is especially welcome for this message: Because a positive assertion passes for expected value undefined if the property does not exist, Show both paths and values: |
Positive assertion If it has no expected value, then the received path must be incomplete: If the received path is empty, display If it has expected value, then the received path might be complete: Note context specific If it has expected value, then the received path might be incomplete: This last test represents TDD updated expected path before updating tested code |
packages/expect/src/__tests__/__snapshots__/matchers.test.js.snap
Outdated
Show resolved
Hide resolved
Yes, thank you for improving grammar Co-Authored-By: pedrottimark <pedrottimark@gmail.com>
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
For
toHaveProperty
matcher:rejects
orresolves
in matcher hintpass must be initialized
error withexpected path must not be an empty array
When negative assertion fails:
not
between expected label and valueWhen positive assertion fails:
Difference
label) or stringify values, not bothResidue:
getPath
as iterative algorithm and always returnhasEndProp
Test plan
Snapshots for
toHaveProperty
error
fail
pass
See also pictures in following comment.
Example pictures baseline at left and improved at right