-
Notifications
You must be signed in to change notification settings - Fork 370
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
test: cleanup duplicate snapshots #902
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #902 +/- ##
=======================================
Coverage 63.37% 63.37%
=======================================
Files 145 145
Lines 11883 11883
=======================================
Hits 7531 7531
Misses 3885 3885
Partials 467 467 ☔ View full report in Codecov by Sentry. |
It seems that my script doesn't give the exact same order as This might be a suboptimal thing in |
Indeed it uses natural sort. |
Which I went through some annoying conversations with chatgpt to implement in Python without using a package 😅 But na I think the actual problem is some of the new packages have not actually enabled sorting - I'm doing a new PR to address that |
This should be landed after #904 |
While doing #902 I realised we've got a couple of packages using snapshots but not cleaning them up afterwards - this adds a basic script to check for that, based on the existence of the `__snapshots__` directory. Here's what the annotations look like: <img width="739" alt="image" src="https://github.com/google/osv-scanner/assets/3151613/b85d4500-6d00-4faa-a8d0-6dc1358b4b80"> Note that because annotations are only shown for _files_, we annotate the first test file in a directory that doesn't contain `testmain_test.go` to ensure it is visible.
This is sort of a rebase of google#902 but I decided to do a new PR because google#898 updated `go-snaps` and google#904 sorted (literally) `npmrc_test.snap` so the only thing left is to remove the old snapshots which is just in `image_test.snap` Closes google#902
While doing google#902 I realised we've got a couple of packages using snapshots but not cleaning them up afterwards - this adds a basic script to check for that, based on the existence of the `__snapshots__` directory. Here's what the annotations look like: <img width="739" alt="image" src="https://github.com/google/osv-scanner/assets/3151613/b85d4500-6d00-4faa-a8d0-6dc1358b4b80"> Note that because annotations are only shown for _files_, we annotate the first test file in a directory that doesn't contain `testmain_test.go` to ensure it is visible.
While working on #889 I found
go-snaps
had a race condition that meant it sometimes duplicates snapshots - this didn't cause any tests to fail, but was confusing and annoying when I was using the snapshots for mass-checking small tweaks to the new output format.I wrote a small script to clean up these duplicates, but amazingly @gkampitakis has yet again jumped on this quickly and gotten a fix out before I had a chance to mention this to the rest of the team let alone push up my script 😄
This uses my script to cleanup the duplicates and then updates
go-snaps
to the fixed version so that new test runs won't have this problem.For those interested, this is the Python script I wrote
Relates to gkampitakis/go-snaps#96