PR size checks now filter out test files
The CI script that flags oversized pull requests now ignores test files, snapshots, fixtures, and lock files when counting lines. Developers adding comprehensive test coverage won't trigger false size warnings.
When pull requests include test files, snapshots, or lock file updates, the CI size check would flag them as oversized even when production code additions were minimal. This created friction for developers adding thorough test coverage or updating snapshots during refactors.
The PR size check script now excludes test files, snapshots, fixtures, mocks, and pnpm-lock.yaml from the line count. Exclusion patterns cover common test file extensions (.test.ts, .spec.ts, etc.), test directories (__tests__, test/, tests/), snapshot directories, fixture folders, and the dedicated testing package. The error messages and override confirmations now note that test files are excluded, so reviewers understand the reported count reflects production code only.
This lives in the GitHub Actions CI scripts that validate pull request sizes against the 1,000-line limit.
View Original GitHub Description
Summary
Adds file exclusion patterns to the PR size check script so that test files, snapshots, fixtures, mocks, and lock files are not counted toward the 1,000-line addition limit.
What's excluded from the count:
- Test files (
*.test.ts,*.spec.ts,*.test.js,*.spec.js,*.test.mjs,*.spec.mjs) - Test directories (
**/test/**,**/tests/**,**/__tests__/**) - Snapshots (
**/__snapshots__/**,**/*.snap) - Fixtures and mocks (
**/fixtures/**,**/__mocks__/**) - The dedicated testing package (
packages/testing/**) pnpm-lock.yaml(can produce massive diffs on dependency bumps)
The error/override messages are updated to note "test files excluded" so reviewers understand the reported count reflects production code only.
How to test:
- Open a PR with test files and verify the count only reflects non-test additions
- The existing unit tests cover
countFilteredAdditionswith all pattern categories
Related Linear tickets, Github issues, and Community forum posts
<!-- No Linear ticket for this CI maintenance change -->Review / Merge checklist
- I have seen this code, I have run this code, and I take responsibility for this code.
- PR title and summary are descriptive. (conventions)
- Docs updated or follow-up ticket created.
- Tests included.
- PR Labeled with
Backport to Beta,Backport to Stable, orBackport to v1(if the PR is an urgent fix that needs to be backported)
🤖 PR Summary generated by AI