cypress-image-snapshot icon indicating copy to clipboard operation
cypress-image-snapshot copied to clipboard

Fail test with no snapshot file

Open vladimirvolek opened this issue 6 years ago • 7 comments

Is there any option to fail the test if there is NO snapshot?

vladimirvolek avatar May 30 '19 10:05 vladimirvolek

Interesting, not currently. Are you envisioning that at the end of your tests, if any snapshot files exist that were not compared on the run the test would fail?

jackjocross avatar Jun 03 '19 22:06 jackjocross

Yeah it would be really useful to have a flag (to use on CI) where if images are missing the tests fail but working locally (without a flag) it would create missing images

obartra avatar Jul 01 '19 15:07 obartra

Cool, that makes sense. I think we might want to hook into Cypress' test:after:run event to perform these checks.

jackjocross avatar Jul 09 '19 14:07 jackjocross

Any update on this?

devtreehouse avatar Apr 07 '20 21:04 devtreehouse

I'm interested in this as well. I run Cypress in a CI environment, and I'd like to see a failure on my PRs when new snapshots are created. Two reasons:

  • I'd like to be notified that I need to check the new snapshot to make sure it looks as expected.
  • A new snapshot could indicate a regression (e.g. an unexpected change in the name of the snapshot, a test that runs when it should have been skipped, etc.)

axelboc avatar Dec 22 '20 09:12 axelboc

Yes, this would be a very useful option ... and I think it should be default behavior: If you don't find the file to match fail the test. Then you can use the updateSnapshots=true option and update the screenshots locally. @jaredpalmer Is there some option to add a quick fix for this?

Donaab avatar Apr 13 '21 21:04 Donaab

@lexanth would you be willing to create a PR with your solution from df2f147? That would be very helpful for all people using this package in CI :)

DCzajkowski avatar Sep 30 '21 12:09 DCzajkowski

Hey Friends, It seems that this feature is not yet implemented in this library. Is there any fork that has this feature?

balassy avatar Feb 28 '23 10:02 balassy

The library is ded.

vladimirvolek avatar Feb 28 '23 14:02 vladimirvolek