Skip to content

Instantly share code, notes, and snippets.

@jlozovei
Last active May 18, 2023 13:04
Show Gist options
  • Save jlozovei/4265cd7902a2ded15d7f702f04669b76 to your computer and use it in GitHub Desktop.
Save jlozovei/4265cd7902a2ded15d7f702f04669b76 to your computer and use it in GitHub Desktop.
Useful scripts and commands to use while writing tests with Jest
# run a single spec with jest
# -- replace <spec> with the spec's name (i.e. Button)
jest -t='<describeString> <itString>'
npm run test -- -t '<describeString> <itString>'
# run a single spec using file path
# -- replace <path> with the file's path (i.e. src/tests/test.js)
jest <path>
# clear cache
jest --clearCache
# coverage
jest --coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment