nomadcode/bin/test

35 lines
858 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
if [ -f "$root/services/core/go.mod" ]; then
if command -v go >/dev/null 2>&1; then
(cd "$root/services/core" && go test ./...)
else
echo "skip services/core: go not found"
fi
fi
if [ -f "$root/apps/web/package.json" ]; then
if command -v npm >/dev/null 2>&1; then
(
cd "$root/apps/web"
if node -e "process.exit(require('./package.json').scripts?.test ? 0 : 1)" >/dev/null 2>&1; then
npm test -- --run
else
npm run check --if-present
fi
)
else
echo "skip apps/web: npm not found"
fi
fi
if [ -f "$root/apps/mobile/pubspec.yaml" ]; then
if command -v flutter >/dev/null 2>&1; then
(cd "$root/apps/mobile" && flutter test)
else
echo "skip apps/mobile: flutter not found"
fi
fi