pi_coder/run-tests.sh

27 lines
797 B
Bash
Raw Normal View History

#!/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"
)