Skip to content

feat: enable unit tests in CI and renovate auto-merge#210

Merged
kriszyp merged 5 commits into
mainfrom
kris/stupefied-edison-091167
May 23, 2026
Merged

feat: enable unit tests in CI and renovate auto-merge#210
kriszyp merged 5 commits into
mainfrom
kris/stupefied-edison-091167

Conversation

@kriszyp
Copy link
Copy Markdown
Member

@kriszyp kriszyp commented May 21, 2026

Summary

  • Unit tests: Added `npm run test:unit` script running `unitTests/**/*.test.mjs` via mocha. All 6 existing tests in `unitTests/replication/listenerLifecycle.test.mjs` pass.
  • Setup file (`unitTests/unitTestSetup.cjs`): Harper modules have module-level side effects that open storage at import time. This CJS require file sets `STORAGE_PATH`, `_DISABLE_NATS`, and `LOGGING_STDSTREAMS` before ESM test files are evaluated — required for the tests to load without a running server.
  • CI workflow (`.github/workflows/unit-tests.yaml`): Runs on push/PR against Node.js 20 + 22 + 24. Follows the same build-then-test pattern as the integration tests workflow (including `|| true` on build — the codebase currently has pre-existing type errors; same as integration CI).
  • Renovate auto-merge: Added `"automerge": true` to the digest-pin and non-major (minor/patch, stable `!/^0/`) package rules. `internalChecksFilter: "strict"` ensures CI must pass before merging.
  • AGENTS.md: Updated to reflect that `test:unit` now exists in Pro.

Cross-model review (Gemini)

No blockers. Significant concerns addressed:

  • Node 20 added to CI matrix
  • Temp dir cleanup on exit added to setup file
  • Build masking (`|| true`) is intentional — mirrors existing integration CI, pre-existing type errors in the codebase

— Claude

- Add unitTests/unitTestSetup.cjs to bootstrap the minimum Harper
  environment (STORAGE_PATH, _DISABLE_NATS) required before ESM modules
  with module-level side effects can be loaded
- Wire setup file into .mocharc.json via "require" so it runs before
  any test file is evaluated
- Add test:unit script (mocha 'unitTests/**/*.test.mjs') to package.json
- Add .github/workflows/unit-tests.yaml running on Node 22 + 24 for
  push/PR, mirroring the build-then-test pattern used by integration tests
- Enable automerge on renovate's digest-pin and non-major update rules

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kriszyp kriszyp requested review from a team as code owners May 21, 2026 16:06
Comment thread .mocharc.json Outdated
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 21, 2026

Reviewed; no blockers found.

@kriszyp kriszyp marked this pull request as draft May 21, 2026 17:52
- Add Node 20 to unit test CI matrix
- Add temp dir cleanup on process exit in unitTestSetup.cjs
- Update AGENTS.md to reflect that test:unit now exists in Pro

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kriszyp kriszyp requested review from DavidCockerill, cb1kenobi and kylebernhardy and removed request for a team and kylebernhardy May 21, 2026 17:54
@kriszyp kriszyp marked this pull request as ready for review May 21, 2026 17:56
Move --require unitTests/unitTestSetup.cjs from .mocharc.json onto the
test:unit npm script so the env overrides (_DISABLE_NATS, STORAGE_PATH)
don't bleed into other mocha invocations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Keep main's restructured Commands/Repository map/Pro-specific conventions
sections; update test commands block and unitTests description to reflect
the new test:unit script added by this branch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread .github/workflows/unit-tests.yaml Outdated
Consistent with harper repo practice.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kriszyp kriszyp merged commit 19cc55a into main May 23, 2026
29 checks passed
@kriszyp kriszyp deleted the kris/stupefied-edison-091167 branch May 23, 2026 03:39
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.

3 participants