github.com/prebid/prebid-server/v2@v2.18.0/scripts/check_coverage.sh (about)

     1  #!/bin/bash
     2  
     3  
     4  COV_MIN=30
     5  
     6  #cleanup
     7  finish() {
     8  
     9    if [ -d ".cover" ]; then
    10      rm -rf .cover
    11    fi
    12  }
    13  
    14  trap finish EXIT ERR INT TERM
    15  
    16  #start script logic
    17  OUTPUT=`./scripts/coverage.sh`
    18  if [[ "$?" -ne "0" ]]; then
    19    echo -e "$OUTPUT"
    20    exit 1
    21  fi
    22  
    23  while IFS= read -r LINE; do
    24    echo -e "$LINE"
    25    if [[ $LINE =~ "%" ]]; then
    26      PERCENT=$(echo "$LINE"|cut -d: -f2-|cut -d% -f1|cut -d. -f1|tr -d ' ')
    27      if [[ $PERCENT -lt $COV_MIN ]]; then
    28        echo "WARNING: Package has less than ${COV_MIN}% code coverage. Run ./scripts/coverage.sh --html to see a detailed coverage report, and add tests to improve your coverage"
    29      fi
    30    fi
    31  done <<< "$OUTPUT"