Skip to content
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

Report which snapshots are unused #465

Closed
eaculb opened this issue Mar 4, 2021 · 2 comments · Fixed by #467
Closed

Report which snapshots are unused #465

eaculb opened this issue Mar 4, 2021 · 2 comments · Fixed by #467
Labels
feature request New feature or request released

Comments

@eaculb
Copy link
Contributor

eaculb commented Mar 4, 2021

Is your feature request related to a problem? Please describe.

In test suites that are very long, it can be tedious and frustrating to try to find which snapshots are stale/unused after eg many tests are changed. The current report lists how many snapshots were unused, but not which ones.

Describe the solution you'd like

I would like an optional flag that, when provided, will include the locations & names of unused snapshots in the final report.

Describe alternatives you've considered

I don't think there's a great alternative. Usually to find out which snapshots have become obsolete, I have to provide the --snapshot-update option and look at the generated diff. When syrupy is running as a CI step, this means I have to rerun the test suite locally, which can be very time consuming.

Additional context

I would be happy to make a PR to address this issue.

@noahnu
Copy link
Collaborator

noahnu commented Mar 4, 2021

Thank you for opening the feature request!

Perhaps --snapshot-details or something of that sort for a detailed report including file paths?

Feel free to put up a PR. This is the code you'll need to modify, the "lines" of the SnapshotReport: https://github.com/tophat/syrupy/blob/818d405a85c2f1f5db9d673e632677c10cb52ad9/src/syrupy/report.py#L223. Currently we print num_unused, however we also have more detailed information in unused.

If you have any questions, you can always post in this issue, or join us on our discord: https://discord.gg/YhK3GFcZrk

@noahnu noahnu added the feature request New feature or request label Mar 4, 2021
tophat-opensource-bot pushed a commit that referenced this issue Mar 5, 2021
# [1.2.0](v1.1.0...v1.2.0) (2021-03-05)

### Features

* option to report details of unused snapshots ([#467](#467)), close [#465](#465) ([1c50db0](1c50db0))
@tophat-opensource-bot
Copy link
Contributor

🎉 This issue has been resolved in version 1.2.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants