meinaart / cypress-plugin-snapshots

Plugin for snapshot tests in Cypress.io
MIT License
497 stars 118 forks source link

(bug) "Snapshot Updated" always reported as true if readFile fails #182

Closed JoshuaKGoldberg closed 9 months ago

JoshuaKGoldberg commented 3 years ago

Describe the bug

With this code in a test:

cy.visit('http://localhost:3100');
cy.document().toMatchImageSnapshot();

Cypress never updates the snapshot file, and always marks it as updated:

Error:    CypressError: `cy.readFile()` must be passed a non-empty string as its 1st argument. You passed: ``.

To Reproduce Steps to reproduce the behavior:

  1. Set up a new Cypress project (mine is closed source, sorry!)
  2. Add cy.document().toMatchImageSnapshot() to a test
  3. Launch the Cypress runner

Expected behavior Two things:

Screenshots Screenshot of an afterAll image failing

Desktop (please complete the following information):

Additional context Passing a name to the toMatchImageSnapshot call doesn't fix the issue.

JoshuaKGoldberg commented 9 months ago

Closing out my old issues for repos I no longer have context on. If anybody has a need for what this issue was asking about, I'd encourage them/you to file a new issue. Cheers!