File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,9 @@ main () {
36
36
# Change our working directory to the file path provided.
37
37
cd " $FILE_PATH " ;
38
38
39
+ # Make sure we initiate clean up before exiting.
40
+ trap clean_up EXIT;
41
+
39
42
# Create a new coverage-all.out file, that will contain the contents of every individual
40
43
# pkg's `coverage.out`.
41
44
echo " mode: count" > coverage-all.out;
@@ -53,18 +56,17 @@ main () {
53
56
# Check if the current test coverage number is above the threshold.
54
57
check_for_minimum_test_coverage_percentage " $current_test_coverage_number " ;
55
58
56
- # Initiate clean up.
57
- clean_up ;
58
-
59
- # TODO add color here.
60
- echo -e " \e[32mExiting with status code $EXIT_STATUS \e[0m" ;
59
+ exit_status_color= " \e[32m " ;
60
+ if [[ $EXIT_STATUS -eq 1 ]] ; then
61
+ exit_status_color= " \e[31m " ;
62
+ fi
63
+ echo -e $exit_status_color " Exiting with status code $EXIT_STATUS \e[0m\n " ;
61
64
exit $EXIT_STATUS ;
62
65
}
63
66
64
67
check_for_minimum_test_coverage_percentage () {
65
68
local current_test_coverage_number;
66
- current_test_coverage_number=" $1 " ;
67
- current_test_coverage_number=$( echo ${current_test_coverage_number%% .* } ) ;
69
+ current_test_coverage_number=$( echo ${1%% .* } ) ;
68
70
MIN_COVERAGE_PERCENTAGE_NUM=$( echo ${MIN_COVERAGE_PERCENTAGE_NUM%% .* } ) ;
69
71
70
72
if ! [[ " $current_test_coverage_number " -ge " $MIN_COVERAGE_PERCENTAGE_NUM " ]]; then
You can’t perform that action at this time.
0 commit comments