@@ -123,10 +123,9 @@ run_test() {
123123 tmp_output=$( mktemp)
124124
125125 # Debug: Show command being run
126- echo -e " ${BLUE} [DEBUG] Running: $BIN_DIR /check-performance.sh --format text -- paths \" $fixture_file \" --no-log${NC} "
126+ echo -e " ${BLUE} [DEBUG] Running: $BIN_DIR /check-performance.sh --paths \" $fixture_file \" --no-log${NC} "
127127
128- # Explicitly request text format for consistent parsing across all environments
129- " $BIN_DIR /check-performance.sh" --format text --paths " $fixture_file " --no-log > " $tmp_output " 2>&1 || true
128+ " $BIN_DIR /check-performance.sh" --paths " $fixture_file " --no-log > " $tmp_output " 2>&1 || true
130129
131130 # Strip ANSI color codes for parsing (using perl for reliability)
132131 local clean_output
@@ -137,14 +136,23 @@ run_test() {
137136 tail -20 " $tmp_output " | perl -pe ' s/\e\[[0-9;]*m//g' | sed ' s/^/ /'
138137 echo " "
139138
140- # Extract counts from text output (no jq dependency)
139+ # Extract counts from JSON output using jq
140+ # Note: check-performance.sh defaults to JSON format, so we parse JSON
141141 local actual_errors
142142 local actual_warnings
143143
144- # Parse text format output
145- actual_errors=$( echo " $clean_output " | grep -E " ^[[:space:]]*Errors:" | grep -oE ' [0-9]+' | head -1)
146- actual_warnings=$( echo " $clean_output " | grep -E " ^[[:space:]]*Warnings:" | grep -oE ' [0-9]+' | head -1)
147- echo -e " ${BLUE} [DEBUG] Parsed text output${NC} "
144+ # Try to parse as JSON first (default format)
145+ if echo " $clean_output " | jq empty 2> /dev/null; then
146+ # Valid JSON - extract from summary
147+ actual_errors=$( echo " $clean_output " | jq -r ' .summary.total_errors // 0' 2> /dev/null)
148+ actual_warnings=$( echo " $clean_output " | jq -r ' .summary.total_warnings // 0' 2> /dev/null)
149+ echo -e " ${BLUE} [DEBUG] Parsed JSON output${NC} "
150+ else
151+ # Fallback to text format parsing (legacy)
152+ actual_errors=$( echo " $clean_output " | grep -E " ^[[:space:]]*Errors:" | grep -oE ' [0-9]+' | head -1)
153+ actual_warnings=$( echo " $clean_output " | grep -E " ^[[:space:]]*Warnings:" | grep -oE ' [0-9]+' | head -1)
154+ echo -e " ${BLUE} [DEBUG] Parsed text output (fallback)${NC} "
155+ fi
148156
149157 # Default to 0 if not found
150158 actual_errors=${actual_errors:- 0}
0 commit comments