diff options
| author | Jesse Vincent <jesse@primeradiant.com> | 2026-07-23 10:54:50 -0700 |
|---|---|---|
| committer | Jesse Vincent <jesse@primeradiant.com> | 2026-07-23 10:54:50 -0700 |
| commit | 0146173544e48a6bc970b2a7cca1e16c2c697a6d (patch) | |
| tree | 4bb8c807045de5bbcae257c402eeb682bdbbdcc6 /skills/systematic-debugging | |
| parent | 54d0efefd7ce56b82dd32402d26f6aaa3ab75f21 (diff) | |
fix(systematic-debugging): find-polluter accepts ./-prefixed patterns and matches top-level tests
Follow-up to #2011 (which fixed the ./-prefix mismatch for the documented
pattern form): strip a leading ./ from the caller's pattern instead of
double-prefixing it into a never-matching ././ form, and also match the
pattern with '**/' collapsed, since find -path cannot match '**/' against
zero directory levels and silently skipped files directly under the base
directory (src/top.test.ts vs src/**/*.test.ts).
Adds a deterministic test suite for the script with a stubbed npm.
Diffstat (limited to 'skills/systematic-debugging')
| -rwxr-xr-x | skills/systematic-debugging/find-polluter.sh | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/skills/systematic-debugging/find-polluter.sh b/skills/systematic-debugging/find-polluter.sh index d2261c4..985f5d0 100755 --- a/skills/systematic-debugging/find-polluter.sh +++ b/skills/systematic-debugging/find-polluter.sh @@ -18,8 +18,13 @@ echo "🔍 Searching for test that creates: $POLLUTION_CHECK" echo "Test pattern: $TEST_PATTERN" echo "" -# Get list of test files (find . emits ./-prefixed paths) -TEST_FILES=$(find . -path "./$TEST_PATTERN" | sort) +# Get list of test files (find . emits ./-prefixed paths, so accept the +# pattern written with or without a leading ./) +TEST_PATTERN="${TEST_PATTERN#./}" +# find -path can't match '**/' against zero directory levels, so a pattern +# like src/**/*.test.ts would skip src/top.test.ts; also try the pattern +# with '**/' collapsed to cover files directly under the base directory. +TEST_FILES=$(find . \( -path "./$TEST_PATTERN" -o -path "./${TEST_PATTERN//\*\*\//}" \) | sort -u) if [ -z "$TEST_FILES" ]; then TOTAL=0 else |
