fga-eps-mds/2019.1-unbrake

View on GitHub
unbrake-frontend/scripts/check_tests

Summary

Maintainability
Test Coverage
#!/bin/sh

tmpFile="/tmp/unbrake_frontend_test"
errorFrontend="/tmp/.error_tests_frontend"

{ npm test -- -u --no-cache --coverage --ci --testFailureExitCode 1 --colors 2>&1; echo $? > $errorFrontend; } | tee $tmpFile
[ "$(cat $errorFrontend)" = "1" ] && exit 1

# Check for console.log or warnings on tests
grep -e 'console\.*' \
     -e 'Warning: ' \
     $tmpFile &>/dev/null \
  && echo -e "\033[0;31m=======================================\033[0m" \
  && echo -e "\033[0;31m>> Found warnings or consoles on tests <<\033[0m" \
  && echo -e "\033[0;31m=======================================\033[0m" \
  && rm -rf $tmpFile \
  && exit 1

rm -rf $tmpFile
exit 0