jaredpalmer / cypress-image-snapshot

Catch visual regressions in Cypress
MIT License
888 stars 160 forks source link

Diff output path is wrong in error message #153

Open SeanMcP opened 3 years ago

SeanMcP commented 3 years ago

Versions

Description

Here is the diff error message: diff error

The path is:

/Users/seanmcp/dev/PROJECT/cypress/snapshots/pill.spec.js/diff_output/Pill.diff.png

However, the actual path to the screenshot is:

/Users/seanmcp/dev/PROJECT/cypress/snapshots/pill.spec.js/__diff_output__/Pill.diff.png

Note the underscores for __diff_output__.

As a result, I can't copy and paste the path into the browser to view the image.

Exploring

If I log diffOutputPath and message here https://github.com/palmerhq/cypress-image-snapshot/blob/master/src/command.js#L34-L55, then I see the correct values logged, but the incorrect value in the error message:

Correct logs, incorrect message

I was not expecting that, since the only thing you're doing with that value is passing it to Cypress.log().

I had a theory that the double underscores were being stripped from the message string somewhere a long the line. To test this, I added two underscores the spec file name and triggered the error again. However, the underscores were in the error message, so we may be able to rule that out.

SeanMcP commented 3 years ago

If you click "Print to console", then the error message is correct:

Correct console message