Skip to content

Commit f699a3a

Browse files
fix: tests
1 parent 30c4762 commit f699a3a

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

.github/scripts/test-analyzer.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ base_tests_file=$(mktemp)
77

88
function cleanup {
99
rm -f "$current_tests_file" "$base_tests_file"
10+
if [ -d "$temp_dir" ]; then
11+
rm -rf "$temp_dir"
12+
fi
1013
}
1114
trap cleanup EXIT
1215

@@ -21,12 +24,16 @@ while IFS= read -r file; do
2124
extract_tests "$file" || true
2225
done < <(find tests/suites -type f -name "*.test.ts" || true) | sort > "$current_tests_file"
2326

24-
# Save current branch name
27+
# Save current branch name and fetch main
2528
current_branch=$(git rev-parse --abbrev-ref HEAD || echo "unknown")
29+
git fetch origin main >/dev/null 2>&1 || {
30+
echo "Failed to fetch main branch" >&2
31+
exit 1
32+
}
2633

2734
# Create temporary clone for main branch comparison
2835
temp_dir=$(mktemp -d)
29-
git clone --quiet --branch main --single-branch . "$temp_dir"
36+
git worktree add --detach "$temp_dir" origin/main >/dev/null 2>&1
3037

3138
# Extract main branch tests
3239
pushd "$temp_dir" >/dev/null
@@ -37,8 +44,8 @@ while IFS= read -r file; do
3744
done < <(find tests/suites -type f -name "*.test.ts" || true) | sort > "$base_tests_file"
3845
popd >/dev/null
3946

40-
# Cleanup temp directory
41-
rm -rf "$temp_dir"
47+
# Remove the worktree
48+
git worktree remove --force "$temp_dir" >/dev/null 2>&1
4249

4350
# Compare and collect results
4451
new_tests=0

0 commit comments

Comments
 (0)