Skip to content

Commit

Permalink
script test with code coverage results
Browse files Browse the repository at this point in the history
  • Loading branch information
GrantBirki committed Oct 17, 2024
1 parent 028adb6 commit 055d05b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions script/test_with_coverage
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,25 @@ fi

crystal build "$DIR/script/require_spec.cr" -D skip-integration -o "$DIR/bin/require_spec" --exclude-warnings $SHARDS_INSTALL_PATH

if [ -d "$DIR/coverage" ]; then
rm -rf "$DIR/coverage"
fi

mkdir -p "$DIR/coverage"

$KCOV_BIN --clean --include-path=$DIR/src "$DIR/coverage" "$DIR/bin/require_spec"

coverage=0

# grep index.js for "covered":"100.0" to check if all files have 100% coverage
if grep -q '"covered":"100.0"' "$DIR/coverage/index.js"; then
echo -e "${GREEN}All files have 100% coverage!${OFF}"
coverage=0
else
echo -e "${RED}Some files do not have 100% coverage!${OFF}"
coverage=1
fi

CRYSTAL_OPTS="" crystal tool unreachable "$DIR/script/require_spec.cr" --check

exit $coverage

0 comments on commit 055d05b

Please sign in to comment.