americanexpress / jest-image-snapshot

✨ Jest matcher for image comparisons. Most commonly used for visual regression testing.
Apache License 2.0
3.83k stars 198 forks source link

storeReceivedOnFailure refuses to store received images in a CI environment #331

Open GuilleDF opened 1 year ago

GuilleDF commented 1 year ago

I'm trying to make use of the storeReceivedOnFailure option, from the README:

storeReceivedOnFailure: (default: false) Store the received images separately from the composed diff images on failure. This can be useful when updating baseline images from CI.

But when I run it in my CI environment I get the following error:

New snapshot was not written. The update flag must be explicitly passed to write a new snapshot.
 + This is likely because this test is run in a continuous integration (CI) environment in which snapshots are not written by default.
  30 |     failureThresholdType: 'percent',
  31 |     failureThreshold: 0.01,
> 32 |     storeReceivedOnFailure: true,
     |                   ^
  33 |     customReceivedDir: '__snapshots__/__new__',
  34 |   });
  35 | };

I can't pass the update flag as suggested since I still want the test to fail, but I need the images to be written so I can use them in a separate job to update the baseline if needed.

I'm using version 6.1.0

donaldpipowitch commented 11 months ago

I see the same for new snapshots that don't exist yet. I haven't tested it with different snapshots so far, but I'd have expected that the new snapshots would also be saved in the CI within the "received directory", so that I can easily download them from there.