karma-snapshot icon indicating copy to clipboard operation
karma-snapshot copied to clipboard

Add ability to update only one snapshot

Open heatherbooker opened this issue 7 years ago • 1 comments
trafficstars

I would be happy to be corrected if there is already a way to do this, but it would be great to be able to update only a single snapshot or parts of a snapshot - maybe something like an interactive mode (like git add --patch) is I believe how Jest might do it?

I may look into this at some point in the future but I just think it would be really helpful, if anyone wants to take a stab!

heatherbooker avatar Jan 30 '18 18:01 heatherbooker

I think that interactive mode will be quite hard to implement with Karma, it is already implemented with a bunch of hacks and workarounds, but maybe I am wrong.

Maybe something like 2nd argument for matchSnapshot(lang, update) function will be enough to perform fine-grained updates? It is already implemented in chai plugin https://github.com/localvoid/chai-karma-snapshot/blob/c6f87f36635dc96def58e449af2940d32d547768/lib/index.js#L52

localvoid avatar Jan 31 '18 12:01 localvoid