Skip to content

Make the commit hook run a form's slow tests only when the form changes - #427

Merged
captaincole merged 1 commit into
mainfrom
quick-hook
Nov 28, 2026
Merged

captaincole merged 1 commit into
mainfrom
quick-hook

Conversation

@captaincole

@captaincole captaincole commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

In order to make a commit take about 2 minutes, the commit hook no longer runs every form's whole-return tests. It runs them only for the forms that the commit changes.

  • Risk: routine. Every test still runs on GitHub for each pull request.
  • Pattern change: all unit tests on each commit → the fast ones on each commit, and each form's form.test.ts only when the commit changes that form.

What changed

  • The engine has 396 unit test files. The 109 named form.test.ts compute a whole return in each test, and they took 93% of the unit test time.
  • scripts/hook-unit-tests.mjs runs every other unit test, then the form.test.ts of each form folder with a staged file.
  • npm run test:unit still runs all of them, and so does the all gates check.

Example outcome

Part of the hook Before Now
Engine unit tests, busy machine 4 to 7 min 66 s

Verified

  • The new hook ran on this commit and passed.
  • Not run locally: the full unit tests; the all gates check runs them.

Refs

🤖 Generated with Claude Code

…nges the form

Co-Authored-By: Claude <noreply@anthropic.com>
@captaincole
captaincole merged commit 0d93c42 into main Nov 28, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant