Skip to content

Instantly share code, notes, and snippets.

@waliurjs
Last active June 6, 2022 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waliurjs/64939272faea076709d1a91a0af4e18e to your computer and use it in GitHub Desktop.
Save waliurjs/64939272faea076709d1a91a0af4e18e to your computer and use it in GitHub Desktop.
Jest snapshot update using interactive mode
## Update uncommitted changed testcases only: (replace 'jest' with 'yarn test' where applicable)
) jest --watch
) Press w when you have failing testcases
## update specific test file
) jest -u ./__tests__/link.test.js (include parent folders when running from inside of a 'workspace'. Same slash for Windows too.)
OR,
) jest --updateSnapshot ./__tests__/link.test.js
## Pick & choose failing testcases and update snapshots
) jest --watchAll
) If some tests are failing then following menu will be visible. Otherwise "Press 'w' to show more"
) Press i to update failing snapshots interactively. Following menu will appear:
) Press u to update failing snapshots for this test.
) Press s to skip the current test.
) Press q to quit Interactive Snapshot Mode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment