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

Use precise snapshot names when pruning #265

Closed
bahmutov opened this issue Jun 13, 2019 · 3 comments
Closed

Use precise snapshot names when pruning #265

bahmutov opened this issue Jun 13, 2019 · 3 comments
Assignees

Comments

@bahmutov
Copy link
Owner

It is not enough to just check prefix when pruning snapshots - because it will leave bunch of snapshots!

https://github.com/bahmutov/snap-shot-core/blob/master/src/prune.js#L25

Situation:

Imagine a test initially like this one

it('works', () => {
  snapshot('foo')
  snapshot('bar')
})

The snapshots saved will be

  • works 1
  • works 2

Then we remove the second snapshot, leaving

it('works', () => {
  snapshot('foo')
})

BUT when we prune we only pass the name of the TEST "works", and then check all snapshot names if they start with that test name. Because both works 1 and works 2 start with works we assume that they should remain in the file. This is wrong.

@bahmutov bahmutov added the bug label Jun 13, 2019
@bahmutov
Copy link
Owner Author

@bahmutov
Copy link
Owner Author

need to keep track of ALL exact snapshot names for each file

@bahmutov bahmutov self-assigned this Jun 13, 2019
@bahmutov
Copy link
Owner Author

🎉 This issue has been resolved in version 10.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant