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

[Matcher]: toMatchSnapshot for enzyme comp #45

Closed
blainekasten opened this issue Oct 13, 2016 · 3 comments
Closed

[Matcher]: toMatchSnapshot for enzyme comp #45

blainekasten opened this issue Oct 13, 2016 · 3 comments

Comments

@blainekasten
Copy link
Collaborator

blainekasten commented Oct 13, 2016

jest-enzyme ONLY

It would be real cool if we could support enzyme with snapshot testing in jest. Since we rejected it from living in the enzyme repo (enzymejs/enzyme#541), this seems like the natural place.

Of course we would have to fall back to the original toMatchSnapshot if a non-enzyme wrapper was given.

Basic thoughts:

var originalToMatchSnapshot;
toMatchSnapshot(enzymeWrapper) {
  if (notEnzyme(enzymeWrapper)) {
    return originalToMatchSnapshot(enzymeWrapper);
  }

  var snapshotable = convertToCompatibleJSON(enzymeWrapper);
  return originalToMatchSnapshot(snapshotable);
}
@blainekasten
Copy link
Collaborator Author

Looks like we could just use this: https://github.com/adriantoine/enzyme-to-json

@blainekasten
Copy link
Collaborator Author

Tried to implement this, seems like we probably need #44 first as I'm not getting the right class values set for my matcher that I need to get appropriate access to the original toMatchSnapshot matcher.

@blainekasten
Copy link
Collaborator Author

Next try #67

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant