-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
cover
executable file
·45 lines (36 loc) · 1.34 KB
/
cover
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
${SNUGGSI?🔴 Set shell variable to installation location}
declare -r THRESHOLD=70 # Percentage
declare -r HARNESS=$SNUGGSI/bin/test # Test harness
declare -r LIBRARIES=.,test,html-element # resource,middleware,server
declare -r OUTPUT=.nyc_output/ # Represented in Percentage
declare -r EXTENSION=.es # Extension for coverage files
declare -r REPORTER=text # Type of coverage report to generate
declare -r COVER=$SNUGGSI/node_modules/.bin/nyc # Coverage runner
declare -r CHECK=$COVER check-coverage # Coverage checker
declare -r EXCLUDE="**/node_modules,middleware,resource,server,test"
echo "📊 snuggsi ツ Coverage Report"
echo
echo " 🎯 Threshold 👉 $THRESHOLD %"
echo " ➕ Included 👉 $LIBRARIES"
echo " ➖ Excluded 👉 $EXCLUDE"
echo
$COVER \
--exclude=$EXCLUDE \
--reporter=$REPORTER \
--extension=$EXTENSION \
$HARNESS
$CHECK \
--lines $THRESHOLD \
--functions $THRESHOLD \
--statements $THRESHOLD \
$HARNESS
declare -r CODE=$?
echo
echo "📁 Coverage Cleanup"
echo " ⚠️ Removing coverage report artifacts."
echo " 👇 "
echo " 🚮 Removing 👉 $OUTPUT"
echo # Remove output directory
rm -rf $OUTPUT
exit $CODE