From e524608b07e141dca9169120dab2e763a926d049 Mon Sep 17 00:00:00 2001 From: Ahmed Abushagur Date: Fri, 13 Feb 2026 11:19:03 -0800 Subject: [PATCH 1/2] fix: strip ANSI colors before grepping test summary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The mock test output uses ANSI escape codes for colored ✓/✗/━━━ characters, so the grep in the Post summary step couldn't match them. Strip colors with sed first. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5051e9166..e1ad8542c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,5 +24,6 @@ jobs: run: | echo '## Mock Test Results' >> "$GITHUB_STEP_SUMMARY" echo '```' >> "$GITHUB_STEP_SUMMARY" - grep -E '(Results:|✓|✗|skip|━━━)' /tmp/mock-output.log | head -100 >> "$GITHUB_STEP_SUMMARY" + # Strip ANSI color codes before grepping (output has escape sequences) + sed 's/\x1b\[[0-9;]*m//g' /tmp/mock-output.log | grep -E '(Results:|✓|✗|skip|━━━)' | head -100 >> "$GITHUB_STEP_SUMMARY" echo '```' >> "$GITHUB_STEP_SUMMARY" From 696e47c7ec1541e334c1ebc08bebe9c1bde40e6a Mon Sep 17 00:00:00 2001 From: Ahmed Abushagur Date: Fri, 13 Feb 2026 11:22:14 -0800 Subject: [PATCH 2/2] fix: use NO_COLOR standard instead of sed to strip ANSI codes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mock.sh now respects the NO_COLOR env var (https://no-color.org/). CI sets NO_COLOR=1 so grep matches ✓/✗/━━━ cleanly. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/test.yml | 5 +++-- test/mock.sh | 16 ++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e1ad8542c..f15f6f9d1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,6 +17,8 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - name: Run mock tests + env: + NO_COLOR: 1 run: | bash test/mock.sh 2>&1 | tee /tmp/mock-output.log - name: Post summary @@ -24,6 +26,5 @@ jobs: run: | echo '## Mock Test Results' >> "$GITHUB_STEP_SUMMARY" echo '```' >> "$GITHUB_STEP_SUMMARY" - # Strip ANSI color codes before grepping (output has escape sequences) - sed 's/\x1b\[[0-9;]*m//g' /tmp/mock-output.log | grep -E '(Results:|✓|✗|skip|━━━)' | head -100 >> "$GITHUB_STEP_SUMMARY" + grep -E '(Results:|✓|✗|skip|━━━)' /tmp/mock-output.log | head -100 >> "$GITHUB_STEP_SUMMARY" echo '```' >> "$GITHUB_STEP_SUMMARY" diff --git a/test/mock.sh b/test/mock.sh index bae2fb15a..d1c3f4d98 100644 --- a/test/mock.sh +++ b/test/mock.sh @@ -20,12 +20,16 @@ FIXTURES_DIR="${REPO_ROOT}/test/fixtures" TEST_DIR=$(mktemp -d) MOCK_LOG="${TEST_DIR}/mock_calls.log" -# Colors -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -CYAN='\033[0;36m' -NC='\033[0m' +# Colors (respect NO_COLOR standard: https://no-color.org/) +if [[ -n "${NO_COLOR:-}" ]]; then + RED='' GREEN='' YELLOW='' CYAN='' NC='' +else + RED='\033[0;31m' + GREEN='\033[0;32m' + YELLOW='\033[1;33m' + CYAN='\033[0;36m' + NC='\033[0m' +fi # Counters PASSED=0