-
Notifications
You must be signed in to change notification settings - Fork 38
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
Implement toMatchDiffSnapshot
jest matcher.
#11
Implement toMatchDiffSnapshot
jest matcher.
#11
Conversation
src/index.js
Outdated
@@ -64,4 +65,12 @@ function diffReactComponents(valueA: any, valueB: any, options: Options) { | |||
}); | |||
} | |||
|
|||
function toMatchDiffSnapshot(valueA: any, valueB: any, options: Options) { |
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.
options?: Options
interface Matchers { | ||
toMatchDiffSnapshot(valueB: any, options?: DiffOptions): boolean | ||
} | ||
} |
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.
newline pls
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.
Done
@@ -0,0 +1,13 @@ | |||
/// <reference types="jest"/> |
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.
Is this valid in TS land?
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.
I'm not sure. I took jest-immutable-matchers/index.d.ts as an example cause it was working without any configuration with my IDE.
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.
It's still in docs
expect.extend({ toMatchDiffSnapshot: snapshotDiff.toMatchDiffSnapshot }); | ||
}); | ||
|
||
test('foo', () => { |
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.
test('works with default options', () => {})
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.
Just small changes and we're good to go
|
||
test('works with default options', () => { | ||
expect(a).toMatchDiffSnapshot(b); | ||
}); |
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.
Can you also make Flow happy? I'm fine with adding // $FlowFixMe
here for now
Thank you for your hard work @umidbekkarimov ❤️ |
See #10