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

Tests should fail when snapshots are added in CI environment #281

Open
deanohyeah opened this issue Nov 12, 2021 · 0 comments
Open

Tests should fail when snapshots are added in CI environment #281

deanohyeah opened this issue Nov 12, 2021 · 0 comments

Comments

@deanohyeah
Copy link

Currently, if a snapshot doesn't exist it is automatically added and passes.
https://github.com/americanexpress/jest-image-snapshot/blob/main/src/diff-snapshot.js#L207

To be inline with jest snapshots it should fail when CI=true and new snapshots are added.
https://jestjs.io/docs/snapshot-testing#are-snapshots-written-automatically-on-continuous-integration-ci-systems

snapshots in Jest are not automatically written when Jest is run in a CI system without explicitly passing --updateSnapshot. It is expected that all snapshots are part of the code that is run on CI and since new snapshots automatically pass, they should not pass a test run on a CI system. It is recommended to always commit all snapshots and to keep them in version control.

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

1 participant