Skip to content

Commit

Permalink
Fix running in directories containing spaces
Browse files Browse the repository at this point in the history
Fixes #3
  • Loading branch information
Nef10 committed Oct 18, 2021
1 parent b12dda0 commit e4063c6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions swift-test-coverage
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ swift test --enable-code-coverage
echo ""

BIN="$(swift build --show-bin-path)"
FILE="$(find ${BIN} -name '*.xctest')"
FILE="$(find "${BIN}" -name '*.xctest')"
COV="$(dirname "$(which swift)")/llvm-cov"

if [[ "$OSTYPE" == "darwin"* ]]; then
FILE="${FILE}/Contents/MacOS/$(basename $FILE .xctest)"
FILE=""${FILE}"/Contents/MacOS/$(basename "$FILE" .xctest)"
if [[ ! -f "$COV" ]]; then
COV="$(xcrun -f llvm-cov)"
fi
fi

VERSION="$($COV --version | grep --only-matching "version [0-9]*" | cut -c 9-)"
VERSION="$("$COV" --version | grep --only-matching "version [0-9]*" | cut -c 9-)"
ARGS=""

if [ "$VERSION" -gt "12" ]; then
Expand All @@ -25,4 +25,4 @@ if [ -t 1 ] || [ "${GITHUB_ACTIONS}" = true ]; then
ARGS="${ARGS}--use-color "
fi

$COV report "${FILE}" -instr-profile="${BIN}/codecov/default.profdata" -ignore-filename-regex=".build|Tests" $ARGS
"$COV" report "${FILE}" -instr-profile="${BIN}/codecov/default.profdata" -ignore-filename-regex=".build|Tests" $ARGS

0 comments on commit e4063c6

Please sign in to comment.