You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems doable from a cursory look. I would follow the jest approach, requiring prettier if it’s used. I’m interested in implementing this myself, just raising this in case you have objections or suggestions.
The text was updated successfully, but these errors were encountered:
jest captures the stack on calling toMatchInlineSnapshot and then matches up the ast based on the callsite column and line.
There are some challenges doing this with cypress:
the call is async. We'd need to monket patch cypress so the stack trace comes from the sync part of the call rather than being called once async dependencies are fetched. This could be worked around I think, maybe a bit like this: better stack trace/ sourceMaps cypress-io/cypress#881 (comment)
so, I think a workable approach would be to use the test title and the order of the calls to determine the right call to make. This is more limiting, but in practice I can't think of any problems - for instance if you have a forEach around the test and dynamically create the test - this currently works in jest, but it opts out if the same call site is used more than twice - so in practice it only works if the dynamic test name is created only once. The same for abstracted functions - they work but only if called once. So I do not think the limitations are too bad - it would work for me.
Having the assertion separate from the test makes it less likely to be reviewed and makes it harder to align assertion value and test.
Describe the solution you'd like
To implement toMatchInlineSnapshot like jest.
Jest implementation: jestjs/jest@d3a6a74#diff-5d8368ae467702f37535e03f31a2ed96
It seems doable from a cursory look. I would follow the jest approach, requiring prettier if it’s used. I’m interested in implementing this myself, just raising this in case you have objections or suggestions.
The text was updated successfully, but these errors were encountered: