-
Notifications
You must be signed in to change notification settings - Fork 0
/
flutter_test.sh
42 lines (39 loc) · 942 Bytes
/
flutter_test.sh
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
# variables
CYAN=$'\e[0;36m'
NC='\033[0m'
packages=0
runTests() {
testDir=$1
echo "\n${CYAN}$1${NC}"
if [ -d "$testDir" ]; then
cd "$testDir"
flutter test --no-test-assets --coverage . && packages=$((packages+1))
lcov \
--quiet \
--remove coverage/lcov.info \
--output-file coverage/coverage.info \
"lib/src/*_resolver.dart" \
"lib/src/core/factories/*" \
"lib/src/domain/entities/*"
genhtml coverage/coverage.info -o coverage/html
cd -
else echo "No test found"
fi
}
testAllPackages() {
echo "Test in all packages"
for dir in ./*/
do
runTests $dir
done
echo "\nTested packages: $packages"
}
echo "Test all packages? [Y,n]"
read -r input
if [[ $input == "Y" || $input == "y" ]]; then
testAllPackages
else
echo "Package name: "
read -r input
runTests "$input"
fi