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

confirm the snapshots are NOT sorted when pruning #259

Closed
bahmutov opened this issue May 17, 2019 · 2 comments
Closed

confirm the snapshots are NOT sorted when pruning #259

bahmutov opened this issue May 17, 2019 · 2 comments
Assignees

Comments

@bahmutov
Copy link
Owner

if the sorting is turned off using options

@bahmutov bahmutov self-assigned this May 17, 2019
@bahmutov
Copy link
Owner Author

Example in https://github.com/bahmutov/prune-snapshot-example spec.js

Spec file initially

const snapshot = require('snap-shot-it')

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

it('works again', () => {
  snapshot(42)
  snapshot(101)
  // throw new Error('nope')
})

it('uses exact spec name', () => {
  snapshot('this name', 1)
  snapshot('this name again', 2)
})

the snapshot saved

exports['works 1'] = `
foo
`

exports['works 2'] = `
bar
`

exports['works again 1'] = 42

exports['works again 2'] = 101

exports['this name'] = 1

exports['this name again'] = 2

Then let's comment out the snapshot "this name"

it('uses exact spec name', () => {
  // snapshot('this name', 1)
  snapshot('this name again', 2)
})

Run again and we get the snapshot

exports['this name again'] = 2

exports['works 1'] = `
foo
`

exports['works 2'] = `
bar
`

exports['works again 1'] = 42

exports['works again 2'] = 101

So the remaining snapshot "this name again" jumped all the way to the top of some reason

@bahmutov
Copy link
Owner Author

🎉 This issue has been resolved in version 10.1.1 🎉

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