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

Implement toMatchDiffSnapshot jest matcher. #11

Merged
merged 9 commits into from
Aug 10, 2017
Merged

Implement toMatchDiffSnapshot jest matcher. #11

merged 9 commits into from
Aug 10, 2017

Conversation

avocadowastaken
Copy link
Contributor

See #10

src/index.js Outdated
@@ -64,4 +65,12 @@ function diffReactComponents(valueA: any, valueB: any, options: Options) {
});
}

function toMatchDiffSnapshot(valueA: any, valueB: any, options: Options) {
Copy link
Member

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
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline pls

Copy link
Contributor Author

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"/>
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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', () => {
Copy link
Member

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', () => {})

Copy link
Member

@thymikee thymikee left a 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);
});
Copy link
Member

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

@thymikee thymikee merged commit f4c65f7 into jest-community:master Aug 10, 2017
@thymikee
Copy link
Member

Thank you for your hard work @umidbekkarimov ❤️

@avocadowastaken avocadowastaken deleted the add-jest-matcher branch August 10, 2017 16:39
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.

2 participants