fix(retro,ship): count tracked files for the test-file metric, not the working tree

The test-file count ran find over the working tree, sweeping untracked
build output — a Rails repo reported 623 test files when git tracks 17
(37x), skewing retro narratives and ship dashboards. Count via git ls-files
instead; includes the one-line Python-glob widening so non-JS repos stop
undercounting.

Fixes #2307, #1999.

Contributed by @joshRpowell (PR #2308).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-08-14 20:20:56 -07:00
co-authored by Claude Fable 5
parent 1266c152e2
commit 471d3b7a7d
5 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -222,7 +222,7 @@ ls -d test/ tests/ spec/ __tests__/ cypress/ e2e/ 2>/dev/null
\`\`\`bash
# Count test files before any generation
find . -name '*.test.*' -o -name '*.spec.*' -o -name '*_test.*' -o -name '*_spec.*' | grep -v node_modules | wc -l
git ls-files 2>/dev/null | grep -E '(\\.test\\.|\\.spec\\.|_test\\.|_spec\\.)' | wc -l
\`\`\`
Store this number for the PR body.`);
@@ -430,7 +430,7 @@ If no test framework AND user declined bootstrap → diagram only, no generation
\`\`\`bash
# Count test files after generation
find . -name '*.test.*' -o -name '*.spec.*' -o -name '*_test.*' -o -name '*_spec.*' | grep -v node_modules | wc -l
git ls-files 2>/dev/null | grep -E '(\\.test\\.|\\.spec\\.|_test\\.|_spec\\.)' | wc -l
\`\`\`
For PR body: \`Tests: {before} → {after} (+{delta} new)\`