-
Notifications
You must be signed in to change notification settings - Fork 412
feat(toHaveAttribute): support asymmetric matchers for value #93
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
feat(toHaveAttribute): support asymmetric matchers for value #93
Conversation
@gnapse Working on updating the docs. |
632fc3d
to
ff83b2b
Compare
Updated the documentation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good! Just a comment to fix a small typo, and let's take a bit more time to check the types situation.
@gnapse ping |
@revathskumar I'm ready to merge. Can you fix the conflict in the README? You should be able to rebase this on top of master, and when faced with the conflict locally, run And thanks again for your contribution! |
62e2084
to
deb867b
Compare
@gnapse I have rebased and pushed. |
🎉 This PR is included in version 3.2.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
I think the typings are breaking things. I get this after upgrading:
|
Fix for type regression: #101 |
@@ -1,4 +1,5 @@ | |||
import {matcherHint, stringify, printExpected} from 'jest-matcher-utils' | |||
import {equals} from 'expect/build/jasmineUtils' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
equals
is injected into custom matchers as this.equals
: https://jestjs.io/docs/en/expect#thisequalsa-b, it'd be great if you could use that instead
We provide no guarantees that 'expect/build/jasmineUtils'
is an import that will not break at any time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the tip @SimenB!
@revathskumar can you take that since you originally authored this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gnapse Sure. will look into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per the [comment](testing-library#93 (comment)) by @SimenB This will remove the direct import of jasmineUtils `import {equals} from 'expect/build/jasmineUtils'` and instead use `this.equals`. Also removes the added dependency of `expect`.
As per the [comment](#93 (comment)) by @SimenB This will remove the direct import of jasmineUtils `import {equals} from 'expect/build/jasmineUtils'` and instead use `this.equals`. Also removes the added dependency of `expect`.
Fixes #91
Sample Error message

What:
toHaveAttribute
value will acceptasymmetric
matchersWhy:
asymmetric
matchers are handy when we want to do partial matchingHow:
Using the method equals in
expect/JasmineUtils
Checklist: