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

Always generate diff snapshots #335

Open
Tarasikee opened this issue Jun 13, 2023 · 1 comment
Open

Always generate diff snapshots #335

Tarasikee opened this issue Jun 13, 2023 · 1 comment

Comments

@Tarasikee
Copy link

Tarasikee commented Jun 13, 2023

Is there a way to generate diff snapshot even if tests haven't failed?

@wilkuintheair
Copy link

Simple try/catch worked for me:

import { expect as jestExpect } from "@jest/globals";

export const expectToMatchSnapshot = async (screenName) => {
  try {
    await jestExpect(screenName).toMatchImageSnapshot();
  } catch (e) {
    console.log("not matching snapshot");
  }
};

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