Tests: cover remaining runHarperCommand startup-watchdog branches

Open Beginner friendly
#10 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Quiet
Tech stack
node.js, typescript
Domain
testing

Research direction

Start in test/harperLifecycle.test.ts and inspect the existing fixture-script harness and harperBinPath usage. Add coverage for the four listed runHarperCommand branches, then run the existing test suite; done means chunked readiness, spawn errors with closed logs, CI-dependent defaults, and post-readiness streaming are verified.

Written by the indexing model from the issue text.

Description

enhancement good first issue

Summary

Follow-up from #8 / #9. The lifecycle race fixes added the repo's first tests (test/), covering the port helpers, the startup watchdog's main paths, and killHarper's signal logic. A few runHarperCommand branches remain uncovered and are cheap to test — the fixture-script harness in test/harperLifecycle.test.ts (spawning short .cjs scripts via harperBinPath) already supports them, so no real Harper is needed.

Branches to cover

  • Completion marker split across stream chunks — a fixture that emits successfully started across two stdout.write calls/chunks should still be detected as ready (verifies the stdout.includes(...) accumulation, not just per-chunk matching).
  • Spawn-error path — when the runtime/binary can't spawn (e.g. a non-existent/non-executable harperBinPath), runHarperCommand rejects and closes the stdout.log/stderr.log write streams (no leaked FDs). 'exit' never fires on a failed spawn.
  • CI-aware absolute cap defaultDEFAULT_STARTUP_MAX_MS resolves to 300s when process.env.CI is set and 120s otherwise (the IS_CI branch).
  • Post-readiness log streaming — after the ready marker, continued process output is still written to the logDir files and is not re-accumulated into the returned startupOutput snapshot.

Notes

These are functional tests that spawn node child processes — same style as the existing test/ suite. Low effort; good first issue.


🤖 Generated with Claude Code

Dominant language
TypeScript
Stars
1
Forks
0
Avg merge
17d 7h
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from HarperFast/integration-testing

All issues in HarperFast/integration-testing

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.