From 37e4b3f27204b158da24873e4b33c2e06952d527 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 3 Aug 2026 14:31:35 +0800 Subject: [PATCH] fix(ci): strip ANSI codes before grep in vitest_incremental.sh --- scripts/ci/vitest_incremental.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/ci/vitest_incremental.sh b/scripts/ci/vitest_incremental.sh index b94ec6d0e..cef424ae5 100755 --- a/scripts/ci/vitest_incremental.sh +++ b/scripts/ci/vitest_incremental.sh @@ -61,7 +61,9 @@ set -e echo "$VITEST_OUTPUT" # 如果没有找到测试文件,视为通过(改动的文件没有对应测试) -if echo "$VITEST_OUTPUT" | grep -q "No test files found"; then +# 先用 sed 去掉 ANSI 转义码,避免干扰 grep 匹配 +CLEAN_OUTPUT=$(echo "$VITEST_OUTPUT" | sed 's/\x1b\[[0-9;]*m//g') +if echo "$CLEAN_OUTPUT" | grep -q "No test files found"; then echo "" echo "⚠️ 未找到相关测试文件,跳过(非失败)" exit 0