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

Support for inline snapshots #330

Open
mattalxndr opened this issue Feb 7, 2022 · 1 comment
Open

Support for inline snapshots #330

mattalxndr opened this issue Feb 7, 2022 · 1 comment

Comments

@mattalxndr
Copy link

Would be nice to have inline snapshots for this library.

@domsli
Copy link

domsli commented Mar 13, 2022

@mattalexx (As a "workaround") You can do inline snapshots with the snapshotDiff and toMatchInlineSnapshot function.

For example, the following would generate an inline snapshot:

test('snapshot difference between 2 React components state', () => {
  expect(
    snapshotDiff(<Component test="say" />, <Component test="my name" />)
  ).toMatchInlineSnapshot();
});

I think it makes sense to provide a custom matcher though, since it's a cleaner API. This does not seem too hard -- I can submit a pull request for it. Hopefully this project is still being maintained and someone can release a new version though? cc: @thymikee

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

No branches or pull requests

2 participants