meinaart / cypress-plugin-snapshots

Plugin for snapshot tests in Cypress.io
MIT License
498 stars 117 forks source link

question: does `createDiffImage` only apply a performance impact when there is a test failure? #172

Open vegerot opened 3 years ago

vegerot commented 3 years ago

tl;dr ^

If a diff image is only generated when there is a mismatch, then I don't mind a rare performance hit, and would appreciate being able to see the image as a pipeline artifact. On the other hand, if a diff image is generated every single test, then the performance impact is not worth it. In that case, if there were an image mismatch in our pipeline, we would probably just run the test again locally, and change the settings locally to create the diff image.

Looking at https://github.com/meinaart/cypress-plugin-snapshots/blob/a2d733a8d9689582e6cfa2252b0a9f1939726672/src/tasks/matchImageSnapshot.js#L61 , it seems to only create it when a test fails, which is good.

Looking at https://github.com/meinaart/cypress-plugin-snapshots/blob/a2d733a8d9689582e6cfa2252b0a9f1939726672/src/utils/tasks/imageSnapshots.js#L115, it seems to apply whether or not the test fails.