41 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Change to the script's directory
cd "$(dirname "$0")"
# Source logging utilities
source ../formatters/logging/logging.sh
log_title "Spine Tests"
# Check if node/npm is available
if ! command -v npm &> /dev/null; then
log_fail "npm is not installed"
exit 1
fi
# Clean C++ build directory if executable exists but is wrong platform
if [ -f "../spine-cpp/build/headless-test" ]; then
if ! ../spine-cpp/build/headless-test --help >/dev/null 2>&1; then
log_action "Cleaning C++ build directory (wrong platform)"
rm -rf ../spine-cpp/build
log_ok
fi
fi
# Install dependencies if node_modules doesn't exist
if [ ! -d "node_modules" ]; then
log_action "Installing dependencies"
if npm install > /tmp/npm-install.log 2>&1; then
log_ok
else
log_fail
log_detail "$(cat /tmp/npm-install.log)"
exit 1
fi
fi
log_action "Running TypeScript test runner"
# Run the TypeScript headless test runner with all arguments
npx -y tsx src/headless-test-runner.ts "$@"