-
-
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
Added matchers .toBeCloseTo and .toMatch #1277
Added matchers .toBeCloseTo and .toMatch #1277
Conversation
Please rebase :) |
0d1052c
to
2a701fb
Compare
@cpojer done 😊 |
Seems like there are some failures on travis? |
if ( | ||
!(typeof expected === 'string') && | ||
!(Object.prototype.toString.call(expected) === '[object RegExp]') | ||
) { |
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.
@cpojer do you have any idea why the first variant might fail for some cases? In dev tools for the case
expect(diff('a', 'a')).toMatch(/no visual difference/);
expected.constructor
prints [Function: RegExp]
but expected.constructor === RegExp
is false.
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.
#1275
that should fix 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.
got it 👍
rebased and revoked this fix
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! sorry you had to go through this :)
2e35a6e
to
4ee552a
Compare
@@ -109,6 +109,35 @@ const matchers: MatchersObject = { | |||
`'${expected}' (using <=)`; | |||
return {message, pass}; | |||
}, | |||
|
|||
toBeCloseTo(actual: number, expected: number, precision: number) { |
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.
should probably be precision?: number
, because it's optional
070a1cb
to
e223d2b
Compare
e223d2b
to
47d78ec
Compare
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. |
No description provided.