snapshot
snapshot copied to clipboard
Rename command "toMatchSnapshot()"
To better match Jest syntax, based on comment https://www.cypress.io/blog/2018/01/16/end-to-end-snapshot-testing/index.html#comment-3759119610
I agree that this renaming would theoretically make sense because it follows jest. But I also think that it wouldn't fit the cypress context.
Jest
expect(shallow(<Component />)).toMatchSnapshot()
Cypress
cy.wrap(object).toMatchSnapshot()
This is a semantically incorrect sentence. I'd suggest
cy.wrap(object).shouldMatchSnapshot()
This is still not a full blown sentence, but it adapts to Cypress' should command. Alternative would be
cy.wrap(object).should('match.snapshot')
.should('match.snapshot') is the best fit into the existing command / assertion system.
We would just add a chai assertion to do exactly what toMatchSnapshot does. This would also give you expect(subject).to.match.snapshot
@brian-mann why the addiction to "magic strings"?