Skip to content

Commit

Permalink
Renamed variable
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonStoltz committed Apr 8, 2021
1 parent 5b82af6 commit 6329b4e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions x-pack/plugins/enterprise_search/jest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@

# Whether to run Jest on the entire enterprise_search plugin or a specific component/folder

FOLDER="${1:-all}"
if [[ $FOLDER && $FOLDER != "all" ]]
TARGET="${1:-all}"
if [[ $TARGET && $TARGET != "all" ]]
then
# If this is a file
if [[ "$FOLDER" == *".ts"* ]]; then
if [[ "$TARGET" == *".ts"* ]]; then
PATH_WITHOUT_EXTENSION=${1%%.*}
FOLDER="${FOLDER} --collectCoverageFrom='<rootDir>/x-pack/plugins/enterprise_search/${PATH_WITHOUT_EXTENSION}.{ts,tsx}'"
TARGET="${TARGET} --collectCoverageFrom='<rootDir>/x-pack/plugins/enterprise_search/${PATH_WITHOUT_EXTENSION}.{ts,tsx}'"
# If this is a folder
else
FOLDER=${FOLDER%/} # Strip any trailing slash
FOLDER="${FOLDER}/ --collectCoverageFrom='<rootDir>/x-pack/plugins/enterprise_search/${FOLDER}/**/*.{ts,tsx}'"
TARGET=${TARGET%/} # Strip any trailing slash
TARGET="${TARGET}/ --collectCoverageFrom='<rootDir>/x-pack/plugins/enterprise_search/${TARGET}/**/*.{ts,tsx}'"
fi
else
FOLDER=''
TARGET=''
fi

# Pass all remaining arguments (e.g., ...rest) from the 2nd arg onwards
# as an open-ended string. Appends onto to the end the Jest CLI command
# @see https://jestjs.io/docs/en/cli#options
ARGS="${*:2}"

yarn test:jest $FOLDER $ARGS
yarn test:jest $TARGET $ARGS

0 comments on commit 6329b4e

Please sign in to comment.