Repository navigation
Description
Summary
Add a pre-push Husky hook that runs the Jest and Bats test suites before any push reaches the remote. The pre-commit hook (lint-staged) is already in place — this issue covers the missing push-time gate.
Current State
| Hook | Status | What it does |
|---|---|---|
pre-commit |
✅ Exists (.husky/pre-commit) |
Runs npx lint-staged — ESLint + Prettier on staged JS/TS/MD/JSON/YAML |
pre-push |
❌ Missing | Should run Jest (npm run test:js) and Bats shell tests |
Both test runners are already configured and available:
- Jest —
npm run test:js→jest --config .jest.config.cjs --coverage --forceExit --detectOpenHandles - Bats —
batsis indevDependencies; shell agent specs require.batstest files per the CodeRabbit review instructions
husky and lint-staged are both present in devDependencies and the "prepare": "husky" lifecycle script is wired up.
Work Required
-
Create
.husky/pre-pushwith:#!/usr/bin/env sh npm run test:jsAdd a Bats step once
.batstest files exist (see [Workflows/Agents] Validate imports/includes; add bats/jest smoke tests #63 — adding smoke tests is a related task). -
Verify the hook is executable — Husky requires the hook file to have execute permissions (
chmod +x .husky/pre-push). Confirm thepreparescript handles this on fresh installs. -
Update
docs/DEVELOPMENT.md(or equivalent) to document the pre-push behaviour so contributors know pushes will trigger the test suite. -
Update
CONTRIBUTING.mdif it describes local setup, to mention thatnpm ci(which runsprepare→husky) sets up both hooks.
Out of Scope
- Modifying the existing
pre-commithook - Adding Bats tests themselves (tracked in [Workflows/Agents] Validate imports/includes; add bats/jest smoke tests #63)
- CI workflow changes — the push hook is a local developer experience improvement; CI already runs
npm test
Acceptance Criteria
-
.husky/pre-pushexists and is executable - Running
git pushlocally triggersnpm run test:jsand fails the push if tests fail - Hook is documented in
docs/DEVELOPMENT.mdor equivalent -
CONTRIBUTING.mdlocal-setup section references the hook - No regressions to the existing
pre-commithook - PR uses branch prefix
automation/orfix/
Definition of Ready (DoR)
- Scope is clear and bounded
- Current state documented
- Dependencies identified ([Workflows/Agents] Validate imports/includes; add bats/jest smoke tests #63 for future Bats step)
- Acceptance criteria listed
Definition of Done (DoD)
- All acceptance criteria met
- Hook tested on a clean
npm ciinstall - Documentation updated
- Approved by maintainer
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
ci(husky): add pre-push test gate and docs for #62
ashleyshaw commentedon May 27, 2026
Started implementation in PR #458.
docs: fix freshness/link checks and add changelog for #62
chore: add .husky/pre-push hook and fix DEVELOPMENT.md
ci(husky): add pre-push test gate and docs for #62
docs: fix freshness/link checks and add changelog for #62
chore: add .husky/pre-push hook and fix DEVELOPMENT.md
Merge pull request #458 from lightspeedwp/automation/62-husky-pre-push
docs(projects): refresh next-actions sequence after #62 and #64 closeout
docs: add PR #458 links to CHANGELOG and fix test-coverage frontmatter