Skip to content

Instantly share code, notes, and snippets.

@hattmarris
Created July 25, 2019 20:38
Show Gist options
  • Save hattmarris/1fbdd786ce003a16e1dc2f4f52b6810e to your computer and use it in GitHub Desktop.
Save hattmarris/1fbdd786ce003a16e1dc2f4f52b6810e to your computer and use it in GitHub Desktop.
jest coverage in a directory
#!/usr/bin/env bash
echo "jest coverage in a directory"
if [ $# -eq 0 ]
then
echo "No dir supplied"
exit
fi
DIR=$1
MATCH='["'$DIR'/**/*.jsx","!**/*.stories.{js,jsx}"]'
MATCH=${MATCH//webpack\//}
echo $MATCH
jest --collectCoverageFrom=$MATCH --coverage $DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment