forked from trent_larson/crowd-funder-for-time-pwa
- Create zsh-compatible common functions script (test-stability-common-zsh.sh) - Fix script directory detection in zsh runner to use $(dirname "$0") - Update zsh runner to source zsh-compatible common file instead of bash version - Change npm script from test:playwright to test:web to match package.json - Remove duplicate array declarations from zsh runner - Make both scripts executable Resolves "no such file or directory" and "command not found" errors when running zsh scripts.
89 lines
2.7 KiB
Bash
Executable File
89 lines
2.7 KiB
Bash
Executable File
#!/bin/zsh
|
|
|
|
# Test Stability Runner for TimeSafari (Zsh Version)
|
|
# Executes the full test suite 10 times and analyzes failure patterns
|
|
# Author: Matthew Raymer
|
|
|
|
# Source common functions
|
|
SCRIPT_DIR="$(dirname "$0")"
|
|
source "${SCRIPT_DIR}/test-stability-common-zsh.sh"
|
|
|
|
# Zsh-specific overrides and enhancements
|
|
# Note: Associative arrays are now defined in the common file
|
|
|
|
# Enhanced progress tracking for zsh
|
|
track_test_progress_enhanced() {
|
|
local run_number="$1"
|
|
local test_file="$2"
|
|
|
|
log_info "Run $run_number/$TOTAL_RUNS: Executing $test_file"
|
|
|
|
# Enhanced progress bar with zsh-specific features
|
|
local percentage=$((run_number * 100 / TOTAL_RUNS))
|
|
local filled=$((run_number * 50 / TOTAL_RUNS))
|
|
local empty=$((50 - filled))
|
|
|
|
# Create enhanced progress bar
|
|
local progress_bar=""
|
|
for ((i=0; i<filled; i++)); do
|
|
progress_bar+="$PROGRESS_CHAR"
|
|
done
|
|
for ((i=0; i<empty; i++)); do
|
|
progress_bar+="$EMPTY_CHAR"
|
|
done
|
|
|
|
# Print enhanced progress with zsh formatting
|
|
printf "\r${CYAN}[ZSH]${NC} %s [%d%%] (%d/%d) ${MAGENTA}%s${NC}" \
|
|
"$progress_bar" "$percentage" "$run_number" "$TOTAL_RUNS" "$test_file"
|
|
}
|
|
|
|
# Enhanced error handling for zsh
|
|
handle_zsh_error() {
|
|
local error_code=$?
|
|
local error_line=$1
|
|
|
|
if [ $error_code -ne 0 ]; then
|
|
log_error "Zsh error occurred at line $error_line (exit code: $error_code)"
|
|
# Additional zsh-specific error handling can be added here
|
|
fi
|
|
}
|
|
|
|
# Set up zsh error handling
|
|
trap 'handle_zsh_error $LINENO' ERR
|
|
|
|
# Main execution function with zsh enhancements
|
|
main() {
|
|
log_info "Starting enhanced test stability analysis with $TOTAL_RUNS runs (Zsh Version)"
|
|
log_info "Results will be saved to: $RESULTS_DIR"
|
|
echo
|
|
|
|
# Run all test executions with enhanced tracking
|
|
for run_number in $(seq 1 $TOTAL_RUNS); do
|
|
track_test_progress_enhanced "$run_number" "test suite"
|
|
|
|
if run_single_test "$run_number"; then
|
|
log_success "Run $run_number completed successfully"
|
|
else
|
|
log_warning "Run $run_number failed, continuing with remaining runs"
|
|
fi
|
|
|
|
# Enhanced delay with zsh-specific features
|
|
if [ "$run_number" -lt $TOTAL_RUNS ]; then
|
|
# Use zsh's built-in sleep with progress indication
|
|
for i in {1..2}; do
|
|
printf "\r${YELLOW}Waiting...${NC} %d/2" "$i"
|
|
sleep 1
|
|
done
|
|
printf "\r%*s\r" "$(tput cols)" ""
|
|
fi
|
|
done
|
|
|
|
# Generate and display results
|
|
generate_summary_report
|
|
display_final_results
|
|
|
|
log_success "Enhanced test stability analysis complete! (Zsh Version)"
|
|
}
|
|
|
|
# Run main function
|
|
main "$@" |