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