snap-shot
snap-shot copied to clipboard
Use `jest-snapshot`?
Hey! I love what you are doing here. Did you know that the jest-snapshot package is standalone and can be used to use snapshots outside of Jest? I'd like to understand what motivated you to build a completely separate version of this feature rather than integrating jest-snapshot
and sharing the same infrastructure across test frameworks. Thanks!
A couple of reasons (and I have seen the jest-snapshot and the discussion in Ava's case https://github.com/facebook/jest/issues/2497)
- just because I could
- the initial focus was really on doing the snapshots without any framework integration (stack inspection and AST parsing), the actual saving / comparing snapshots was an afterthought.
- the serialize / deserialize API and plugins were not in the form that matched my needs. I moved the saving and comparing snapshots into small utility module https://github.com/bahmutov/snap-shot-core - this is the closest to
jest-snapshot
. It gives me an ability to pass compare and save functions which I used to implementschema-shot
for example https://github.com/bahmutov/schema-shot
Another big part in this was my desire to try out automated release process where all tests would be in separate modules using semantic-release plugin dont-crack
+ automated dependency upgrades using greenkeeper.io
. This seems to work pretty well, but I needed full control to set this up.
Thanks, that's a good answer! I'm wondering about how the State constructor in jest-snapshot
could be changed to make it work well for your use base. Since we are fundamentally doing the same thing (like, literally exactly the same thing), I believe there is value in sharing some infrastructure. Do you agree? :)
all for it, will do!
I'm just looking into this plugin and was stumbling on this post ...
@cpojer how would you use jest-snapshot
in another system than jest? I want to use it in combination with mocha
but it seems that there is no documentation available, so sticking to this extension would be my choice here.
@bahmutov your first argument just because I could
is an argument I can understand from a personal perspective, but out of a business perspective this argument would rather give me a reason to go with jest-snapshot
.