pi_coder/run-tests.sh
dschlueter 7b13c4996d test: Unit-Tests für normalizeForComparison, parseVerdict, parseBlockers
28 Tests für die drei reinen Hilfsfunktionen aus pi-coder-judge-extension.ts.
run-tests.sh führt test-utils.ts ohne ts-node aus (sed-basiertes TS→JS-Stripping).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 18:14:03 +02:00

27 lines
797 B
Bash
Executable file

#!/usr/bin/env bash
# Unit-Tests für pi-coder-judge-extension.ts
# Keine Abhängigkeiten außer node — entfernt TypeScript-Annotationen on-the-fly.
set -euo pipefail
TS_FILE="$(dirname "$0")/test-utils.ts"
if ! command -v node &>/dev/null; then
echo "❌ node nicht gefunden" >&2
exit 1
fi
# TypeScript-Annotationen entfernen: `: string`, `: unknown`, `: void`, `: boolean`
# und `function f(a: T, b: T)` → `function f(a, b)` (einfache Parameterlisten)
node --input-type=module < <(
sed \
-e 's/: string\b//g' \
-e 's/: unknown\b//g' \
-e 's/: void\b//g' \
-e 's/: boolean\b//g' \
-e 's/: number\b//g' \
-e 's/(s: )/(s)/g' \
-e 's/(text: )/(text)/g' \
-e 's/(actual, expected: unknown, label: string)/( actual, expected, label)/g' \
"$TS_FILE"
)