Skip to content

Commit c142c72

Browse files
committed
Reorganize code
1 parent aff016a commit c142c72

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

.github/workflows/build-check-install.yaml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -532,18 +532,25 @@ jobs:
532532
# tests/testthat/test-shinytest2-foo.R -> foo
533533
# R/foo.R -> foo
534534
base_name=$(basename "$file" .R | sed s/test-shinytest2-//g)
535+
# Find matching test files (parenthesis to not match arguments)
536+
test_files=$(grep -l "$base_name(" "$test_dir"test-shinytest2-*.R)
535537
536-
# Find matching test files
537-
test_files=$(grep -l "$base_name" "$test_dir"test-shinytest2-*.R)
538-
539-
if [ -z "$test_files" ]; then
540-
echo "No test files found for modified file about $base_name."
541-
else
542-
echo "${file} matches ${test_files}"
538+
# Modify in place so that only modified modules are tested.
539+
if [[ -n "$test_files" ]]
540+
then {
543541
sed -i 's/skip_if_too_deep(5)/skip_if_too_deep(3)/g' "$test_files"
544-
fi
542+
TESTING_DEPTH=3
543+
} else {
544+
# Flag for helpers
545+
helper_modified="yes"
546+
} fi
547+
548+
# R file without corresponding test file: assume it affects all
549+
if [[ -n "$helper_modified" ]]
550+
then {
551+
TESTING_DEPTH=5
552+
} fi
545553
done
546-
TESTING_DEPTH=3
547554
shell: bash
548555

549556
- name: Build R package 🏗

0 commit comments

Comments
 (0)