Skip to content

Instantly share code, notes, and snippets.

@ivanbtrujillo
Last active December 19, 2022 08:58
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 ivanbtrujillo/4d415b651dcbc5d4ea72806bf42beecb to your computer and use it in GitHub Desktop.
Save ivanbtrujillo/4d415b651dcbc5d4ea72806bf42beecb to your computer and use it in GitHub Desktop.
Jest single file coverage watch
If you want to test a single file using jest, and get the coverage of that single file
instead of the coverage of the whole project, you can use this command:
npx jest [file_name] --coverage --collectCoverageFrom=[path_to_file.extension] --watch
Example:
npx jest logout --coverage --collectCoverageFrom=./src/modules/logout/logout.tsx --watch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment