-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckcoverage.sh
More file actions
executable file
·45 lines (31 loc) · 1.17 KB
/
Copy pathcheckcoverage.sh
File metadata and controls
executable file
·45 lines (31 loc) · 1.17 KB
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
if [ ! -z $1 ]; then
if [ $1 -lt 0 ] || [ $1 -gt 100 ]; then
echo "Threshold should be between 0 and 100"
threshold=80
fi
threshold=$1
else
threshold=80
fi
cd src/ContractHttp
dotnet build
cd ../../tools
dotnet restore
# Instrument assemblies inside 'test' folder to detect hits for source files inside 'src' folder
dotnet minicover instrument --workdir ../ --assemblies tests/**/bin/**/*.dll --sources src/**/*.cs
# Reset hits count in case minicover was run for this project
dotnet minicover reset
cd ..
for project in tests/**/*.csproj; do dotnet test --no-build $project; done
cd tools
# Uninstrument assemblies, it's important if you're going to publish or deploy build outputs
dotnet minicover uninstrument --workdir ../
# Create HTML reports inside folder coverage-html
# This command returns failure if the coverage is lower than the threshold
dotnet minicover htmlreport --workdir ../ --threshold $threshold
# Print console report
# This command returns failure if the coverage is lower than the threshold
dotnet minicover report --workdir ../ --threshold $threshold
# Create NCover report
dotnet minicover xmlreport --workdir ../ --threshold $threshold
cd ..