Skip to content

Commit 6bf9673

Browse files
Anton StandrikAnton Standrik
authored andcommitted
fix: skipped tests
1 parent 36ce36b commit 6bf9673

File tree

1 file changed

+11
-24
lines changed

1 file changed

+11
-24
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ jobs:
231231
added_tests=()
232232
deleted_tests=()
233233
skipped_tests=()
234-
existing_tests=()
235234
236235
# Function to extract test names from a file
237236
extract_test_names() {
@@ -242,25 +241,7 @@ jobs:
242241
fi
243242
}
244243
245-
# First, get all existing tests in current branch
246-
for file in $(git ls-files | grep -E '^tests/suites/.*\.(spec|test)\.(ts|tsx|js|jsx)$'); do
247-
while IFS= read -r test; do
248-
if [[ -n "$test" ]]; then
249-
existing_tests+=("$test")
250-
fi
251-
done < <(extract_test_names "$file" HEAD)
252-
done
253-
254-
# Get skipped tests from test results, but only if they exist in current branch
255-
if [ -f "playwright-artifacts/test-results.json" ]; then
256-
while IFS= read -r test; do
257-
if [[ -n "$test" ]] && printf '%s\n' "${existing_tests[@]}" | grep -Fxq "$test"; then
258-
skipped_tests+=("$test")
259-
fi
260-
done < <(jq -r '.suites[].specs[] | select(.ok == false and .skipped == true) | .title' playwright-artifacts/test-results.json)
261-
fi
262-
263-
# Get list of changed test files
244+
# First, get list of changed test files and analyze deletions
264245
for file in $(git diff --name-only main...HEAD | grep -E '^tests/suites/.*\.(spec|test)\.(ts|tsx|js|jsx)$'); do
265246
# Get test names from both versions
266247
current_tests=$(extract_test_names "$file" HEAD)
@@ -279,15 +260,21 @@ jobs:
279260
while IFS= read -r test; do
280261
if [[ -n "$test" ]]; then
281262
if ! echo "$current_tests" | grep -Fxq "$test"; then
282-
# Only count as deleted if it's not marked as skipped
283-
if ! printf '%s\n' "${skipped_tests[@]}" | grep -Fxq "$test"; then
284-
deleted_tests+=("$test")
285-
fi
263+
deleted_tests+=("$test")
286264
fi
287265
fi
288266
done <<< "$base_tests"
289267
done
290268
269+
# Separately, get skipped tests from test results
270+
if [ -f "playwright-artifacts/test-results.json" ]; then
271+
while IFS= read -r test; do
272+
if [[ -n "$test" ]]; then
273+
skipped_tests+=("$test")
274+
fi
275+
done < <(jq -r '.suites[].specs[] | select(.ok == false and .skipped == true) | .title' playwright-artifacts/test-results.json)
276+
fi
277+
291278
# Create JSON output
292279
echo "added_tests=$(IFS=,; echo "${added_tests[*]}")" >> $GITHUB_OUTPUT
293280
echo "deleted_tests=$(IFS=,; echo "${deleted_tests[*]}")" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)