Initial commit: add .gitignore and README
This commit is contained in:
61
utils/test-all.sh
Executable file
61
utils/test-all.sh
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Load shared libraries
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/../lib/init.sh"
|
||||
|
||||
# Test All Projects Script
|
||||
# Runs tests for all projects that have test scripts
|
||||
|
||||
set -e
|
||||
|
||||
echo "🧪 Running tests for all projects..."
|
||||
|
||||
PROJECTS_DIR="."
|
||||
TESTED=0
|
||||
FAILED=0
|
||||
|
||||
test_project() {
|
||||
local project=$1
|
||||
|
||||
if [ -f "$project/package.json" ]; then
|
||||
cd "$project"
|
||||
|
||||
# Check if test script exists
|
||||
if grep -q "\"test\"" package.json; then
|
||||
echo "🧪 Testing $project..."
|
||||
if npm test 2>/dev/null || pnpm test 2>/dev/null; then
|
||||
echo " ✅ $project - Tests passed"
|
||||
((TESTED++))
|
||||
else
|
||||
echo " ❌ $project - Tests failed"
|
||||
((FAILED++))
|
||||
fi
|
||||
else
|
||||
echo " ⏭️ $project - No test script"
|
||||
fi
|
||||
|
||||
cd ..
|
||||
fi
|
||||
}
|
||||
|
||||
echo "📋 Testing projects..."
|
||||
|
||||
# Test all projects with package.json
|
||||
for dir in */; do
|
||||
if [ -d "$dir" ] && [ "$dir" != "node_modules/" ] && [ "$dir" != ".git/" ] && [ "$dir" != "scripts/" ]; then
|
||||
test_project "$dir"
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "📊 Test Summary:"
|
||||
echo " ✅ Tested: $TESTED"
|
||||
echo " ❌ Failed: $FAILED"
|
||||
|
||||
if [ $FAILED -gt 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ All tests passed!"
|
||||
|
||||
Reference in New Issue
Block a user