@@ -233,19 +233,17 @@ jobs:
233233 }
234234 trap cleanup EXIT
235235
236- echo "Setting up git configuration..."
237- git config --global user.email "github-actions[bot]@users.noreply.github.com"
238- git config --global user.name "github-actions[bot]"
236+ function extract_tests() {
237+ local file=$1
238+ echo "Processing file: $file" >&2
239+ # Look for test declarations and extract just the test name between quotes
240+ perl -ne 'if (/test\(['\''"](.+?)['\''"]/) { print "$1|'$file'\n" }' "$file"
241+ }
239242
240243 echo "Extracting current branch tests..."
241244 while IFS= read -r file; do
242- while IFS= read -r line; do
243- if [[ $line =~ test\([\"\'](.*)[\"\']\) ]]; then
244- test_name="${BASH_REMATCH[1]}"
245- echo "$test_name|$file"
246- fi
247- done < "$file"
248- done < <(find tests/suites -type f -name "*.test.ts") > "$current_tests_file"
245+ extract_tests "$file"
246+ done < <(find tests/suites -type f -name "*.test.ts") | sort > "$current_tests_file"
249247
250248 echo "Fetching main branch..."
251249 git fetch origin main:main
@@ -259,14 +257,9 @@ jobs:
259257 echo "Extracting main branch tests..."
260258 while IFS= read -r file; do
261259 if [ -f "$file" ]; then
262- while IFS= read -r line; do
263- if [[ $line =~ test\([\"\'](.*)[\"\']\) ]]; then
264- test_name="${BASH_REMATCH[1]}"
265- echo "$test_name|$file"
266- fi
267- done < "$file"
260+ extract_tests "$file"
268261 fi
269- done < <(find tests/suites -type f -name "*.test.ts") > "$base_tests_file"
262+ done < <(find tests/suites -type f -name "*.test.ts") | sort > "$base_tests_file"
270263
271264 echo "Returning to original branch..."
272265 git checkout "$current_branch"
0 commit comments