Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit 198967b

Browse files
committed
Updates to fix make test-unit function correctly
1 parent f597484 commit 198967b

File tree

3 files changed

+17
-29
lines changed

3 files changed

+17
-29
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,3 +288,5 @@ __queuestorage__
288288

289289
# Gitleaks report
290290
gitleaks-report.json
291+
292+
coverage/

scripts/tests/test.mk

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,13 @@ test: # Run all the test tasks @Testing
6565
test-load
6666

6767
_test:
68-
set -e
69-
script="./scripts/tests/${name}.sh"
70-
if [ -e "$${script}" ]; then
71-
exec $${script}
72-
else
73-
echo "make test-${name} not implemented: $${script} not found" >&2
68+
@set -e; \
69+
script="./scripts/tests/$(name).sh"; \
70+
if [ -e "$$script" ]; then \
71+
exec "$$script"; \
72+
else \
73+
echo "make test-$(name) not implemented: $$script not found" >&2; \
74+
exit 1; \
7475
fi
7576

7677
${VERBOSE}.SILENT: \

scripts/tests/unit.sh

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,14 @@
11
#!/bin/bash
2-
32
set -euo pipefail
43

5-
cd "$(git rev-parse --show-toplevel)"
6-
7-
dir="$PWD"
8-
UnitDir="$dir/tests/"
9-
ResDir="$UnitDir"results-unit
10-
Format="trx"
11-
12-
# Find all *.csproj files excluding the IntegrationTests folder and execute dotnet test, with build for now
13-
find "$UnitDir" -name '*.csproj' -not -path "$UnitDir/IntegrationTests/*" | while read -r file; do
14-
echo -e "\nRunning unit tests for:\n$file"
15-
dotnet test "$file" --filter "TestCategory!=Integration" --logger $Format --verbosity quiet
16-
done
17-
4+
COVERAGE_DIR="coverage"
5+
TEST_PROJECTS=$(find tests -name '*.csproj')
186

19-
# Move all trx result files into a separate folder, for easier reporting
20-
mkdir -p "$ResDir"
21-
find "$UnitDir" -name "*.$Format" -not -path "$ResDir/*" | while read -r resfile; do
22-
mv "$resfile" "$ResDir"
7+
for proj in $TEST_PROJECTS; do
8+
echo "🧪 Running tests for $proj..."
9+
dotnet test "$proj" \
10+
--collect:"XPlat Code Coverage" \
11+
--results-directory "$COVERAGE_DIR/$(basename "$proj" .csproj)"
2312
done
2413

25-
# List created results
26-
echo -e "\nCreated result files:\n"
27-
find "$ResDir" -name "*.$Format"
28-
29-
# echo "Test execution completed. See scripts/tests/unit.sh for more."
14+
echo "✅ All tests completed. Coverage reports in $COVERAGE_DIR/"

0 commit comments

Comments
 (0)