Add integration-tests CI and fix harness CLI resolution - #5
Conversation
The reference repo was already on harper@^5 with @harperfast/integration-testing
and an integrationTests/ suite, but two gaps would prevent its tests from ever
running:
- No .github/workflows/integration-tests.yml existed, so integration tests had
no CI gate. Added the standard workflow (Node 22/24/26, actions pinned to
commit hashes).
- The test did not pass `harperBinPath`. harper's `exports` map only exposes
".", so the harness's default `require.resolve('harper/dist/bin/harper.js')`
throws ERR_PACKAGE_PATH_NOT_EXPORTED and the cwd-ancestor fallback finds no
dist/bin/harper.js, so getHarperScript() throws "Harper CLI script not found"
before Harper ever starts. Resolve the CLI from harper's exported main entry
and pass it via the documented `harperBinPath` escape hatch.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request updates the integration tests to explicitly resolve the harper binary path and pass it to setupHarperWithFixture, which prevents an ERR_PACKAGE_PATH_NOT_EXPORTED error. Feedback suggests using the native import.meta.resolve instead of creating a CommonJS require helper via createRequire to simplify the ESM resolution.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
- Add timeout-minutes: 15 to integration-tests job (prevents 6-hour default CI burn if a test or teardown hangs) - Move harperBinPath computation inside before() hook (a top-level throw causes a silent module crash with no TAP output; inside the hook it surfaces as a proper test failure) Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
|
Review follow-up (autonomous agent): Fixed both blocking findings: added |
Bump the harper dependency to ^5.2.1 and regenerate the lockfile. Regenerated in full so the optional native deps (bufferutil, utf-8-validate, segfault-handler) stay in the tree for Linux CI. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The previous lockfile was generated with npm 11, which does not auto-install the peer dependencies of an optional dependency. harper 5.2.1 pulls alasql, which optionally depends on react-native-fs, whose peers (react-native, react) npm 12 installs and npm 11 does not. CI runs npm 12 on Node 24/26, so npm ci failed there with those packages "missing from lock file" while Node 22 (npm 11) passed. Regenerated with npm 12 so the lockfile carries the full tree. lockfileVersion stays 3; npm ci verified under both npm 11 and npm 12. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Resolves the conflict with main and closes the remaining review threads on #5. Merge: main had bumped harper to ^5.1.13 while this branch went to ^5.2.1; kept ^5.2.1. main's dot-env.example update comes across unchanged. Lockfile regenerated with npm 12 (the npm CI runs) and npm ci verified. The conflict is also why this PR reported no CI. The workflow is registered and active, and ran on this branch until 2026-06-11 — GitHub cannot construct the pull_request merge ref for a conflicting PR, so no runs were queued after main diverged. It is not a missing or malformed workflow; merging should bring checks back. Workflow: - top-level `permissions: contents: read` (was inheriting the repo/org default, which can be read-write; these jobs only read) - `cache: 'npm'` on setup-node, so three matrix legs stop re-downloading the whole tree - dropped the checkout from generate-node-version-matrix, which never reads repository content - bound the workflow_dispatch input to an env var instead of interpolating it into the run block. Not raised on this PR, but it is the same shell-injection sink the sibling repos fixed: `type: choice` constrains the UI, not the workflow_dispatch API. timeout-minutes: 15 was already in place from an earlier round. app.test.ts: the harperBinPath resolution already sits inside before() so a failure surfaces as a named test failure rather than a silent module-load crash. Expanded the comment to record that it is a tracked workaround rather than an oversight — what it assumes about harper's dist/ layout, that the harness's own existsSync check makes the failure loud rather than silent, and that the real fix is upstream (harper exporting its bin path, or the harness resolving from a package name). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Summary
Verification of the v5 reference repo (Path B). The repo was already correctly on
harper@^5.0.11with@harperfast/integration-testing, anintegrationTests/suite, and atest:integrationscript. No v5 migration patterns remain (wasLoadedFromSource,blob.save,harperdbimports/globals all absent). However two gaps would prevent the integration tests from ever running, so this PR fills them:Missing CI workflow — there was no
.github/workflows/integration-tests.yml(and no CI runs in the repo at all). Added the standard workflow: Node matrix22, 24, 26, actions pinned to commit hashes (checkoutv6.0.3,setup-nodev6.4.0,upload-artifactv7.0.1).Harness CLI resolution would break —
integrationTests/app.test.tsdid not passharperBinPath. harper'sexportsmap only exposes".", so the harness's default auto-resolutionrequire.resolve('harper/dist/bin/harper.js')throwsERR_PACKAGE_PATH_NOT_EXPORTED; the cwd-ancestor fallback also finds nodist/bin/harper.js, sogetHarperScript()throws "Harper CLI script not found" before Harper ever starts. Verified empirically against harper@5.0.11 + integration-testing@0.3.1. Fixed by resolving the CLI from harper's exported main entry and passing it via the documentedharperBinPathescape hatch.Verification
npm run test:integrationlocally. With the fix, the harness now gets past CLI resolution (noERR_PACKAGE_PATH_NOT_EXPORTED, no "CLI script not found") and proceeds to Harper startup, where it fails only at the macOS loopback bind (EADDRNOTAVAILon 127.0.0.2+). That is a known environmental limitation of this dev machine (loopback aliases not configured, requires interactive sudo) — not a code bug. Onubuntu-latestCI the full 127.0.0.0/8 range is available, so the gate runs without aliasing.Notes
env-fix, Claude-model tweak) is unrelated and untouched.harperBinPathworkaround isn't needed in every consumer repo.🤖 Generated with Claude Code