-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: use whole snapshot file to store data, do not store data as string #27
Comments
Same for our use-case, we generate TS type definitions, markdown, etc. and would like to have them as separate files with syntax highlight, see Maxim-Mazurok/google-api-typings-generator#706 |
With a short delay 😅 @Maxim-Mazurok , @milahu |
Hi Igor :) Yes, having them as separate files would be very nice to have! We're still using this library and have a 2MB snapshot with all the files generated for testing... https://github.com/Maxim-Mazurok/google-api-typings-generator/blob/master/test/restDocs/__snapshots__/test.spec.ts.snap This likely goes against the idea of reviewing snapshots like a normal code... But our goal was to use snapshots to ensure that we don't break generation when refactoring code, so I think they worked very well for our case. This is however relatively low priority at the moment as these weren't touched in a while, but I have some ideas to migrate from generating markdown with strings and use some sort of programmatic generation, which will be huge change and we'll need snapshots again when working on Maxim-Mazurok/google-api-typings-generator#657 |
update: i implemented a proof-of-concept of such a "one file per snapshot" test runner with jest-file-snapshot in milahu/mitosis@69382fd (see also BuilderIO/mitosis#856 (comment)) |
Interesting, sounds like |
Cool, going to close this one then. |
Randomly found out that vitest has |
expected result (content of snapshot file)
actual result
challenges
jest-snapshot/State.save()
use test-filename as directory name, and store test snapshots as files in that dir
use case
in my tests i record API calls to a html canvas elemet (using jest-canvas-mock)
and im storing the events as javascript source code
benefits:
snapshot is human-readable and machine-readable
recorded events can easily be replayed to a live canvas element
The text was updated successfully, but these errors were encountered: